I'm using XmlTextWriter (.NET) to create an xml file for a client to read orders into their system when they process an order.
Obviously, most of the time there will be more than one items in the order so I will have to loop through the OrderDetails table for a given Order and repeat a certain part of the XML file for each record.
Several records should go like this, at least according to the sample documentation that I got.
for example:
But what happens is that instead of putting them like this it nests them -- which I'm not sure is correct or not:
VS.NET gives me this message when I try to display it in the data view mode of the xml editor:
Although this XML document is well formed, it contains structure that the Data View cannot display. The same table (Product) cannot be the child table in two nested relations.
If I leave out the WriteEndElement() at the end of the loop (WriteStartElement("Product") is at the beginning), it just goes ahead and nests the tables any way, just as if the WriteEndElement() was there.
Are both of these correct? Will my client be able to read the data if it is nested like that? If not how can I correct it so that it doesn't nest the tables?
Thanks for the help.
Obviously, most of the time there will be more than one items in the order so I will have to loop through the OrderDetails table for a given Order and repeat a certain part of the XML file for each record.
Several records should go like this, at least according to the sample documentation that I got.
for example:
Code:
<Product>
<LineItem>123</LineItem>
<Quantity>1</Quantity>
....
</Product>
<Product>
<LineItem>456</LineItem>
<Quantity>1</Quantity>
....
</Product>
<Product>
<LineItem>890</LineItem>
<Quantity>1</Quantity>
....
</Product>
But what happens is that instead of putting them like this it nests them -- which I'm not sure is correct or not:
Code:
<Product>
<LineItem>123</LineItem>
<Quantity>1</Quantity>
....
<Product>
<LineItem>456</LineItem>
<Quantity>1</Quantity>
....
<Product>
<LineItem>890</LineItem>
<Quantity>1</Quantity>
....
</Product>
</Product>
</Product>
VS.NET gives me this message when I try to display it in the data view mode of the xml editor:
Although this XML document is well formed, it contains structure that the Data View cannot display. The same table (Product) cannot be the child table in two nested relations.
If I leave out the WriteEndElement() at the end of the loop (WriteStartElement("Product") is at the beginning), it just goes ahead and nests the tables any way, just as if the WriteEndElement() was there.
Are both of these correct? Will my client be able to read the data if it is nested like that? If not how can I correct it so that it doesn't nest the tables?
Thanks for the help.