Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSD question (same attributes, different elements...)

Reply
Thread Tools

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

 
 
Gooseman
Guest
Posts: n/a
 
      01-22-2004
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!
 
Reply With Quote
 
 
 
 
DFN-CIS NetNews Service
Guest
Posts: n/a
 
      01-22-2004
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 xmlnss="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>

--
Stuart
Friends may come and go, but enemies accumulate.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML + XSD: Is it possible to get all errors against the XSD? Markus Java 1 11-22-2005 02:53 PM
Difference between <import ....xsd> and <xlink:href=.....xsd> ???? Bernd Oninger XML 1 06-30-2004 08:21 AM
xsd:any as a child of xsd:all Peter Aberline XML 0 04-05-2004 03:38 PM
referencing another XSD file within an XSD file JavaDeveloper@nowhere.com XML 1 01-14-2004 05:22 PM
XSD document for XSD defintion Rick Razzano XML 1 09-26-2003 12:41 AM



Advertisments