asked 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?

asked
User Eunjin
by
7.9k 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.

answered
User JIANG
by
7.8k 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>

answered
User Aslan
by
8.2k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.