Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

name conflict

Status
Not open for further replies.

dogmaa

Programmer
Dec 14, 2001
10
0
0
GB
I am working with a supplied XML document format
that is sent to me over an HTTP connection to a supplier.
I cannot change the format!

But the problem is that within the XML document I
have 2 nodes with the same name, "Price".


In XSD schema the 1st price is defined as a complex type

<xs:element name =&quot;Price&quot; type=&quot;PriceType&quot;/>
<xs:complexType name=&quot;PriceType&quot;>
<xs:sequence>
<xs:element name=&quot;Type&quot; type=&quot;TypeType&quot;/>
<xs:element name=&quot;Code&quot; type=&quot;CodeType&quot;/>
<xs:element name=&quot;Ref&quot; type=&quot;RefType&quot;/>
<xs:element name=&quot;Allocation&quot; type=&quot;AllocationType&quot;/>
<xs:element name=&quot;Request&quot; type=&quot;RequestType&quot;/>
</xs:sequence>
</xs:complexType>


and later as part of another complex type.

This time it is supposed to be a simple type. The node name
is the same but the value returned is actually a
straightforward decimal.

The following schema is the second occurence and was generated automatically from the sample XML document.


<xs:element name =&quot;Extra&quot; type=&quot;ExtraType&quot;/>
<xs:complexType name=&quot;ExtraType&quot;>
<xs:sequence>
<xs:element name=&quot;Code&quot; type=&quot;CodeType&quot;/>
<xs:element name=&quot;Description&quot; type=&quot;DescriptionType&quot;/>
<xs:element name=&quot;Allocation&quot; type=&quot;AllocationType&quot;/>
<xs:element name=&quot;Request&quot; type=&quot;RequestType&quot;/>
<xs:element name=&quot;Price&quot; type=&quot;PriceType&quot;/>
</xs:sequence>
</xs:complexType>



To solve this I tried to manually change the type of the 2nd
price node to &quot;PriceAmountType&quot; which I added to the XSD schema
after the re-definition of the &quot;ExtraType&quot; as follows

<xs:element name =&quot;Extra&quot; type=&quot;ExtraType&quot;/>
<xs:complexType name=&quot;ExtraType&quot;>
<xs:sequence>
<xs:element name=&quot;Code&quot; type=&quot;CodeType&quot;/>
<xs:element name=&quot;Description&quot; type=&quot;DescriptionType&quot;/>
<xs:element name=&quot;Allocation&quot; type=&quot;AllocationType&quot;/>
<xs:element name=&quot;Request&quot; type=&quot;RequestType&quot;/>
<xs:element name=&quot;Price&quot; type=&quot;PriceAmountType&quot;/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name=&quot;PriceAmountType&quot;>
<xs:restriction base=&quot;xs:decimal&quot;/>
</xs:simpleType>

but the xml tool I'm using still thinks the price node
is a complex type.


The problem is that I dont know whether the tool is at fault
or the definition of the document.
w3c has information about redefining names but that appears
to be name conflicts between name spaces.

Anybody know the answer ??? [cry]











 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top