In order to restrict values that can be assigned to an attribute:
Declare the attribute and associate it with a user-defined simple data type.
Create a simple data type by using the XSD simpleType element.
Use the XSD restriction element within the simpleType element to restrict the values that can be assigned to the elements or attributes that use the simple data type.
Exercises
Create a Schema for music.xml
Create groups of elements and attributes
Feature of creating grouped elements and attributes facilitates the following tasks:
Creating a reusable group of elements and attributes.
Selecting a single element from a group.
Specifying the sequence of elements.
XSD provides the following elements to group user-defined elements and attributes:
sequence
group
choice
all
attributeGroup
Create groups of elements and attributes (cont.)
Sequence
Ensures that the elements declared within the opening and closing tags appear in a specific order.
0 comments
Post a comment