xsd
Question posted by: timothy-tim@lycos.com
(Guest)
on
July 12th, 2006 09:45 PM
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
1
Answer Posted
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
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Join Bytes! wrote:
Quote:
Originally Posted by
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
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 197,043 network members.
Top Community Contributors
|