25.2k views
3 votes
If you were building an XML Schema and wanted to limit the values allowed in an xs:string field to only those in a particular list, what XML tag would you use in your XML Schema definition?

User Eunjin
by
4.3k points

2 Answers

3 votes

Answer and explanation:

After some research on this task, and if I was building an XML Schema and wanted to limit the values allowed in an xs:string field to only those in a particular list, I would use the enumeration constraint so that I get to limit the content of acceptable values.

User JIANG
by
4.1k points
4 votes

Answer:

enumeration constraint.

Step-by-step explanation:

Enumeration constraints is a definition term or tag in programming language, that is used in assigning values to variables in order to generate partial solutions, so as to remove from the constraint network the conflicting values that do not lead to any feasible solution.

For example: not xs:element or xs:sequence

Here, using enumeration constraints, to limit the content of an XML element to a set of acceptable values:

The example below defines an element called "music_genre" with a restriction. The only acceptable values are: Blues, Reggae, Country:

Hence:

Using not xs:element

<xs:element name="music_genre">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="Blues"/>

<xs:enumeration value="Reggae"/>

<xs:enumeration value="Country"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

User Aslan
by
4.2k points