By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,028 IT Pros & Developers. It's quick & easy.

Finding the correct location for inserting node (Repost)

P: n/a
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/
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.