473,796 Members | 2,482 Online
Bytes | Software Development & Data Engineering Community
+ 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 1889
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*******@news group.nospam> wrote in message
news:9B******** *************** ***********@mic rosoft.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"?>
<FormDefiniti on xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "Forms.xsd" >
<FormName FormTypeAttrib= "Country">F orm A</FormName>
<FormTitle>Stat ic Form Title</FormTitle>
</FormDefinition>
<!--end First XML Document!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!-->

<!--Start Second XML Document!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!-->
<?xml version="1.0" encoding="UTF-8"?>
<FormDefiniti on xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "Forms.xsd" >
<UserDescriptio n InputType="Text Area" ReadFromDB="tru e">This is what the
user can fill in</UserDescription >
<SignOffs>
<Staus InputType="Drop DownList" ReadFromDB="tru e"/>
<Comment InputType="Text Area" ReadFromDB="tru e"/>
</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*******@news group.nospam> wrote in message
news:9B******** *************** ***********@mic rosoft.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*******@news group.nospam> wrote in message
news:9B******** *************** ***********@mic rosoft.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
2070
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. Word loads, data gets pasted in and it merges fine. One problem tho, it's doing Form Letters rather than Mailing Labels Here's the code...
1
1969
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> <timestampbegin>000045.20</timestampbegin>
3
2539
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 can envision unions of node sets, and unions of node text. But I know there's much more to the subject than that, if not more alternatives than greater technical detail. TIA,
2
9556
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 to create a textfile which is the datasource for the mail merge process, then I'm trying to run Word and mail merge. The code I am trying to use in Javascript is:
2
1305
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 append one document to the other. Don't want to have MS Office installed on the server, need a component that can be shipped, preferrebly with a redistributable license. Thanks.
4
1479
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 set and create
0
1366
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 which add all word docs to one word document. Thanks in Advance Maheshwari
0
6299
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 reformating, after the merge. This is a full description of my needs. I have a C# class library that creates two Crystal Reports, and then exports them to the harddrive as Word documents. One's orientation is landscape, the other is portrait. I then...
2
1363
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 totals or sum of the common elements. For example: Doc A
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10221
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
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 we have to send another system

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.