A
abu.butt
Hi,
I am still a newbie with XML and was hoping someone could help me with
this query. I want to create an XML Schema that would allow me to have
two elements that have a different structure in two different areas of
XML. It's probably easier if I provide a sample XML :-
<MyXML>
<MDP type="MDP">
<linkFactor type="linkFactor">
<value type="decimal">0.9</value>
</linkFactor>
</MDP>
<MDS type="MDS">
<linkFactor type="linkFactor">0.90</linkFactor>
</MDS>
</MyXML>
Basically, in the above sample linkfactor is present twice, but in the
MDP section I want it to have a value tag.
Is it possible to create an XML Schema to correspond to this ?
I was thinking I need to hide the definitions of linkfactor so that I
have two one for each element. My thoughts of what the actual schema
defn. of this type would be
<xs:complexType name="linkFactorType" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="value" type="valueType"/>
</xs:choice>
<xs:attribute name="type" type="xs:string" use="required"/>
</xs:complexType>
for the expanded version that includes the value tag and
<xs:element name="linkFactor" type="linkFactorType"/>
for the simpler type. Just confused on how to pick-up one defn over the
other.
Any guidance greatly appreciated.
Many Thanks,
Ab
I am still a newbie with XML and was hoping someone could help me with
this query. I want to create an XML Schema that would allow me to have
two elements that have a different structure in two different areas of
XML. It's probably easier if I provide a sample XML :-
<MyXML>
<MDP type="MDP">
<linkFactor type="linkFactor">
<value type="decimal">0.9</value>
</linkFactor>
</MDP>
<MDS type="MDS">
<linkFactor type="linkFactor">0.90</linkFactor>
</MDS>
</MyXML>
Basically, in the above sample linkfactor is present twice, but in the
MDP section I want it to have a value tag.
Is it possible to create an XML Schema to correspond to this ?
I was thinking I need to hide the definitions of linkfactor so that I
have two one for each element. My thoughts of what the actual schema
defn. of this type would be
<xs:complexType name="linkFactorType" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="value" type="valueType"/>
</xs:choice>
<xs:attribute name="type" type="xs:string" use="required"/>
</xs:complexType>
for the expanded version that includes the value tag and
<xs:element name="linkFactor" type="linkFactorType"/>
for the simpler type. Just confused on how to pick-up one defn over the
other.
Any guidance greatly appreciated.
Many Thanks,
Ab