restriction problemt, attribute from an nested element

c_capatana

Usenet Archive
Joined
Nov 4, 2003
Messages
4
Reaction score
0
i have 2 abstract type defined:

<xs:complexType name="InputHeaderType" id="InputHeaderType" abstract="false"> <xs:complexContent> <xs:restriction base="xs:anyType"> <xs:sequence/> <xs:attribute name="InputField" type="sg:InputFieldType" use="required"/> <xs:attribute name="keyfield" type="sg:KeyfieldType" use="required"/> <xs:attribute name="FieldX" type="sg:FieldXType" use="required"/> </xs:restriction> </xs:complexContent> </xs:complexType>

<xs:complexType name="OutputHeaderType" id="OutputHeaderType" abstract="false"> <xs:complexContent> <xs:restriction base="xs:anyType"> <xs:sequence/> <xs:attribute name="OutputField" type="sg:OutputFieldType" use="required"/> <xs:attribute name="keyfield" type="sg:KeyfieldType" use="required"/> <xs:attribute name="FieldY" type="sg:FieldYType" use="required"/> </xs:restriction> </xs:complexContent> </xs:complexType>

<xs:complexType name ="HeaderType">
<xs:choice>
<xs:element name="InputHeader" type="sg:InputHeaderType"/> <xs:element name="OutputHeader" type="sg:OutputHeaderType"/> </xs:choice> </xs:complexType>

I want something as below, but errors appear.
Can i use an attribute from one of the inside element?
I can create XXInputHeaderType, XXHeaderOutputType but i preffer something like this.

<xs:complexType name="XXHeaderType">
<xs:complexContent>
<xs:restriction base="sg:HeaderType">
<xs:attribute name="keyfield" type="sg:keyfieldType"
use="required" fixed="XX"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>

Thanks.
 

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

Forum statistics

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

Latest Threads

Top