Hi,
Say for example I have this simple XSD:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://tempuri.org/po.xsd"
xmlns="http://tempuri.org/po.xsd" elementFormDefault="qualified">
<xs:element name="purchaseOrder" type="PurchaseOrderType"/>
<xs:element name="comment" type="xs:string"/>
<xs:complexType name="PurchaseOrderType">
<xs:sequence>
<xs:element name="shipTo" type="xs:string"/>
<xs:element name="billTo" type="xs:string"/>
<xs:element name="comment" type="xs:string" minOccurs="0"/>
<xs:element name="itemId" type="xs:string"/>
</xs:sequence>
<xs:attribute name="orderDate" type="xs:date"/>
</xs:complexType>
</xs:schema>
Now for example I have the an XML instance of the above XSD but without the
"comment" node, however at a future date someone may need to insert the
comment node. If I don't follow the XSD I can simply append the comment node
in the purchaseOrder node, but that will be wrong because it has to be in
sequence which is after the billTo and before itemId.
How can I correctly find the location of the insert node? This problem is
worsen with the fact that there are several XSDs that I need to handle so
somehow I need to be able to do this in a generic way.
Thanks,
---
Victor Hadianto
http://www.synop.com/Products/SauceReader/