xsd

timothy-tim

Usenet Archive
Joined
Jul 12, 2006
Messages
1
Reaction score
0
I am fairly new to XSD so I assume this is probably a FAQ.

I have a Complex Type say "Foo" which is present as child element of many xs:element.

In just one of these elements Bar, I want Foo to have additional attributes/Facets

for example in the schema below
<xs:complexType name="Bar">
<xs:sequence>
<xs:element name="Foo" type="Foo" maxOccurs="unbounded" minOccurs="0"> </xs:element> </xs:sequence> </xs:complexType>

I want Foo to have an additional attirubtute called IsTrue="xs:Boolean"

How do I achive this? Do I have to declare a new type for this?

-Tim
 

George Bina

Usenet Archive
Joined
Jan 30, 2004
Messages
134
Reaction score
0
Hi,

Yes, you need to declare a new type that will extend Foo and will add the attribute that you want. You can do that either with a local type declaration like

<xs:element name="Foo" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:extension base="Foo"> <xs:attribute name="isTrue" type="xs:boolean"/> </xs:extension> </xs:complexType> </xs:element>

or by defining a new named type and refer to that instead of Foo.

Best Regards,
George
 

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,049
Messages
3,104,244
Members
248,133
Latest member
DujonT

Latest Threads

Top