472,144 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,144 software developers and data experts.

Merging XML Documents (with ADO.NET?)

I have got 2 XML documents, both of which conform to the same XSD Schema,
which define possible optional elements. The 2 XML documents contain 2
disjoint set of XML elements.

What is the best, easiest, most efficient way of merging the 2 XML
Documents? Can I use DataSet.Merge() facility in ADO.NET?? Any
pre-requisites?

Any other suggestions?
Nov 12 '05 #1
3 1774
Patrick,

Can you provide an example of each XML document? Its not clear to me how
the schema can be the same if each XML document has different sets of XML
elements.

Also, you didn't indicate what you wanted to do after merging the XML
documents. By mentioning a DataSet, I assume you want to work with the
combined data in tables and views.

The simplest suggestion I have, without more info, is to simply concatenate
remove the root tag of one XML document and append the fragment to the other
XML document.

Ad.

"Patrick" <qu*******@newsgroup.nospam> wrote in message
news:9B**********************************@microsof t.com...
I have got 2 XML documents, both of which conform to the same XSD Schema,
which define possible optional elements. The 2 XML documents contain 2
disjoint set of XML elements.

What is the best, easiest, most efficient way of merging the 2 XML
Documents? Can I use DataSet.Merge() facility in ADO.NET?? Any
pre-requisites?

Any other suggestions?

Nov 12 '05 #2
Example XML documents are:
<!--Start First XML Document!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<?xml version="1.0" encoding="UTF-8"?>
<FormDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Forms.xsd">
<FormName FormTypeAttrib="Country">Form A</FormName>
<FormTitle>Static Form Title</FormTitle>
</FormDefinition>
<!--end First XML Document!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->

<!--Start Second XML Document!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<?xml version="1.0" encoding="UTF-8"?>
<FormDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Forms.xsd">
<UserDescription InputType="TextArea" ReadFromDB="true">This is what the
user can fill in</UserDescription>
<SignOffs>
<Staus InputType="DropDownList" ReadFromDB="true"/>
<Comment InputType="TextArea" ReadFromDB="true"/>
</SignOffs>
</FormDefinition>
<!--End First XML Document!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->

They can share the same XSD Schema because the XSD elements are defined as
optional! After I merge the XML documents, I intend to iterate through it
and based on the attributes, etc. render an ASP.NET webform. What is the
best way of merging them?

"Adrian Moore" wrote:
Patrick,

Can you provide an example of each XML document? Its not clear to me how
the schema can be the same if each XML document has different sets of XML
elements.

Also, you didn't indicate what you wanted to do after merging the XML
documents. By mentioning a DataSet, I assume you want to work with the
combined data in tables and views.

The simplest suggestion I have, without more info, is to simply concatenate
remove the root tag of one XML document and append the fragment to the other
XML document.

Ad.

"Patrick" <qu*******@newsgroup.nospam> wrote in message
news:9B**********************************@microsof t.com...
I have got 2 XML documents, both of which conform to the same XSD Schema,
which define possible optional elements. The 2 XML documents contain 2
disjoint set of XML elements.

What is the best, easiest, most efficient way of merging the 2 XML
Documents? Can I use DataSet.Merge() facility in ADO.NET?? Any
pre-requisites?

Any other suggestions?


Nov 12 '05 #3
Not al XSD's qualify to be a dataset. If indeed your XSD does qualifies to
be a dataset, then you can use dataset.merge, after ReadXmlSchema.

Otherwise, the best way to merge is using the XmlDocument.

- Sahil Malik [MVP]
http://codebetter.com/blogs/sahil.malik/

"Patrick" <qu*******@newsgroup.nospam> wrote in message
news:9B**********************************@microsof t.com...
I have got 2 XML documents, both of which conform to the same XSD Schema,
which define possible optional elements. The 2 XML documents contain 2
disjoint set of XML elements.

What is the best, easiest, most efficient way of merging the 2 XML
Documents? Can I use DataSet.Merge() facility in ADO.NET?? Any
pre-requisites?

Any other suggestions?

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dan Nash | last post: by
1 post views Thread by Mael Guillemot | last post: by
3 posts views Thread by William Ahern | last post: by
2 posts views Thread by North Country Boy | last post: by
2 posts views Thread by Marina | last post: by
4 posts views Thread by rottyguy70 | last post: by
reply views Thread by Maheshwari | last post: by
reply views Thread by mharris | last post: by
2 posts views Thread by Garikayi Mukombachoto | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.