restriction problemt, attribute from an nested element

C

c_capatana

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top