XSD question (same attributes, different elements...)

Gooseman

Usenet Archive
Joined
Jan 22, 2004
Messages
1
Reaction score
0
Hi

Just getting into XSD and have some questions:

If I have several different elements that all have identical attibutes, what is the best way of conveying that in the XSD?

Is there a way of defining that an attribute must be either xs:ID OR a set of predefined lables (ie something like xs:ID | "specific_lable_1" | "specific_lable_2" ?

The XSD schema I am writing is fully defined, yet some of the attributes for the various elements are yet to be implemented. What's the best way of adding a "not yet implemented" flag to these attributes?

Thanks!
 

DFN-CIS NetNews Service

Usenet Archive
Joined
Jan 20, 2004
Messages
18
Reaction score
0
On 22/01/2004, around 11:24, Gooseman wrote:
G> Hi

G> Just getting into XSD and have some questions:

G> If I have several different elements that all have identical G> attibutes, what is the best way of conveying that in the XSD? You want to look up 'attribute groups' ...

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="root"> <xs:complexType> <xs:sequence> <xs:element ref="element1"/> </xs:sequence> <xs:attributeGroup ref="ag1"/> </xs:complexType> </xs:element> <xs:element name="element1" type="xs:string"/> <xs:attribute name="att1" type="xs:string"/> <xs:attribute name="att2" type="xs:string"/> <xs:attribute name="att3" type="xs:string"/> <xs:attributeGroup name="ag1"> <xs:attribute ref="att1" use="required"/> <xs:attribute ref="att2" use="optional"/> </xs:attributeGroup> <xs:attributeGroup name="ag2"> <xs:attribute ref="att2" use="required"/> <xs:attribute ref="att3" use="required"/> </xs:attributeGroup> </xs:schema>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top