F
Fred Chateau
I'm having a problem translating nested XML to relational tables and would
appreciate anyone's advice with it.
I've written some code in C# that retrieves a fairly complex XML document
structure from a remote server and loads in into a dataset. Originally, the
complete XML document would not load because of conflicts caused by nested
nodes of the same name in different parts of the document.
I generated a schema by separating out parts of the XML which would load
successfully, eliminating the conflicting nodes in the schema, and then
re-integrating the XML schema without the conflicting nodes. To my surprise
this worked fairly well. I can now load the incoming XML into the dataset,
minus the conflicting nodes and their accompanying data.
So I was wondering if there was a way to set up a mapping of the identically
named nodes so that I can recover the data in those parts of the document.
Since the document will not load with the complete schema, I'm assuming this
cannot be accomplished using DataSet methods, but I was hoping for a way to
do it within the schema itself.
An example fragment is listed below:
<overview>
< . . . >
</. . . >
<nearbyLocations>
<restaurants>
<location>
<name>Red Lobster</name>
<distance>1/2 mile</distance>
</location>
<location>
<name>Olive Garden</name>
<distance>1 mile</distance>
</location>
</restaurants>
<attractions>
<location>
<name>Walt Disney World</name>
<distance>8 miles</distance>
</location>
</attractions>
</nearbyLocations>
< . . . >
</. . . >
</overview>
appreciate anyone's advice with it.
I've written some code in C# that retrieves a fairly complex XML document
structure from a remote server and loads in into a dataset. Originally, the
complete XML document would not load because of conflicts caused by nested
nodes of the same name in different parts of the document.
I generated a schema by separating out parts of the XML which would load
successfully, eliminating the conflicting nodes in the schema, and then
re-integrating the XML schema without the conflicting nodes. To my surprise
this worked fairly well. I can now load the incoming XML into the dataset,
minus the conflicting nodes and their accompanying data.
So I was wondering if there was a way to set up a mapping of the identically
named nodes so that I can recover the data in those parts of the document.
Since the document will not load with the complete schema, I'm assuming this
cannot be accomplished using DataSet methods, but I was hoping for a way to
do it within the schema itself.
An example fragment is listed below:
<overview>
< . . . >
</. . . >
<nearbyLocations>
<restaurants>
<location>
<name>Red Lobster</name>
<distance>1/2 mile</distance>
</location>
<location>
<name>Olive Garden</name>
<distance>1 mile</distance>
</location>
</restaurants>
<attractions>
<location>
<name>Walt Disney World</name>
<distance>8 miles</distance>
</location>
</attractions>
</nearbyLocations>
< . . . >
</. . . >
</overview>