473,473 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1854
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan Nash | last post by:
Hi guys I wonder if you could help. I'm trying to create a bespoke interface for mail merging from an Access database in Word. At the moment, I'm just trying it with CSV files, and it works....
1
by: Mael Guillemot | last post by:
Hi, I have one xml looking like this: ========================= <video> <shot id="1"> <timestampbegin>000030.90</timestampbegin> <feature>blabla</feature>...
3
by: William Ahern | last post by:
I'm looking for resources on splitting and merging XML trees. Specifically, on methods to pare large XML documents into smaller documents which can be merged later. Off of the top of my head, I...
2
by: North Country Boy | last post by:
Hi I'm trying to run the mail merge operation in MS Word from within Javascript. I've already done this in VB but I'm having problems trying to do the same thing in Javascript. First I am trying...
2
by: Marina | last post by:
Anyone know of any 3rd party components that can allow for programmatic merging of Word documents? Also one that does the same for Excel spreadsheets? Really looking for something that can just...
4
by: rottyguy70 | last post by:
hello, am trying to do the following with little success. any help is appreciated. 1) assume i have a static mapping: a -> 1 b -> 2 c -> 3 2) i need to read through some data, let's say...
0
by: Maheshwari | last post by:
Hi Can you please help with some info on how to open existing word documents / merge two word documents from a C# program ? My user will select 2 or many word docs and i have to create a c# exe...
0
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather...
2
by: Garikayi Mukombachoto | last post by:
Hi I would really appreciate any assistanance with the following situation. Lets say i have 2+ documents A,B,...n that i need to merge together, such that the resulting documents contains...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.