473,795 Members | 3,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

generic xml merge possible?

Hi Group,

I'm new to XML, here is my question:

Would it be possible to write an algorithm that takes in two XML
documents with the only condition being that they have the same root
element? If it is possible what would be the best technology to
implement the solution (XMLDom, XSLT...)? How hard would the solution
be?

Thanks

Feb 28 '06 #1
8 1872
> Would it be possible to write an algorithm that takes in two XML
documents with the only condition being that they have the same root
element?


And does what with them? If you want an answer, you need to ask a
complete question.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Feb 28 '06 #2
merges them

Feb 28 '06 #3
il********@gmai l.com wrote:
merges them


The simple answer it that this can be done using any generic XML
processing tool. I'd do it in XSLT, myself. The complex answer is that
this becomes an arbitrarily complex task depending the details of
exactly what you mean by merge.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Feb 28 '06 #4

il********@gmai l.com wrote:
Would it be possible to write an algorithm that takes in two XML
documents


Yes.

The next question is what "merge" means. Simple concatenation?
Immediate root-children sorted by some definable key? What happens if
there's a "duplicate" element, and how might you define duplicate?

For grinding data files by hand, I generally use XSLT and XPath. This
works fine for one-off hacks with smaller documents. If I started to
care about algorithms and performance I might look at programs that ran
over the DOM, or even something using SAX (if they were huge documents
with simple merges)

Algorithms from the '60s (read Knuth !) start to look interesting
again, when you're dealing with merge-sorts on datasets to big to hold
in memory (i.e. DOM) simultaneously.

Feb 28 '06 #5
You can merge xml-files with the toolbox <xml>cmp
(http://www.xmlcmp.com).
<xml>cmp is desigend for merging, comparing, sorting and regrouping
large files by low memory consumption.


Andy Dingley <di*****@codesm iths.com> wrote:
il********@gmai l.com wrote:
Would it be possible to write an algorithm that takes in two XML
documents


Yes.

The next question is what "merge" means. Simple concatenation?
Immediate root-children sorted by some definable key? What happens if
there's a "duplicate" element, and how might you define duplicate?

For grinding data files by hand, I generally use XSLT and XPath. This
works fine for one-off hacks with smaller documents. If I started to
care about algorithms and performance I might look at programs that ran
over the DOM, or even something using SAX (if they were huge documents
with simple merges)

Algorithms from the '60s (read Knuth !) start to look interesting
again, when you're dealing with merge-sorts on datasets to big to hold
in memory (i.e. DOM) simultaneously.


Feb 28 '06 #6
Hi,

For a free solution : http://freshmeat.net/projects/libxmldiff/

The outputted diff is a simple merge with "diff:statu s attributes" ; so
if you are only interested in merging files, you only have to delete the
diff:status attribute by "delete //@diff:status"

Hth,

--
Rémi Peyronnet

fi*****@sofika. de a écrit :
You can merge xml-files with the toolbox <xml>cmp
(http://www.xmlcmp.com).
<xml>cmp is desigend for merging, comparing, sorting and regrouping
large files by low memory consumption.


Andy Dingley <di*****@codesm iths.com> wrote:
il********@gmai l.com wrote:
Would it be possible to write an algorithm that takes in two XML
documents

Yes.

The next question is what "merge" means. Simple concatenation?
Immediate root-children sorted by some definable key? What happens if
there's a "duplicate" element, and how might you define duplicate?

For grinding data files by hand, I generally use XSLT and XPath. This
works fine for one-off hacks with smaller documents. If I started to
care about algorithms and performance I might look at programs that ran
over the DOM, or even something using SAX (if they were huge documents
with simple merges)

Algorithms from the '60s (read Knuth !) start to look interesting
again, when you're dealing with merge-sorts on datasets to big to hold
in memory (i.e. DOM) simultaneously.

Feb 28 '06 #7
Duplicate elements would be one problem. I think that another one
would be if you had merged in an element that had the same ancestors as
another element. Would you create a new branch or would you make it a
sibling? I think that it could change the meaning of the data for some
applications.

<a>
<b>
<c>Hi</c>
</b>
<b>
<d>Hello</d>
</b>
</a>

versus:

<a>
<b>
<c>Hi</c>
<d>Hello</d>
</b>
</a>

The next question is what "merge" means. Simple concatenation?
Immediate root-children sorted by some definable key? What happens if
there's a "duplicate" element, and how might you define duplicate?


Feb 28 '06 #8
il********@gmai l.com wrote:
Duplicate elements would be one problem. I think that another one
would be if you had merged in an element that had the same ancestors as
another element. Would you create a new branch or would you make it a
sibling? I think that it could change the meaning of the data for some
applications.


Which is why the concept of "merge" has to be defined more precisely --
either as a generic one-size-fits-some-but-not-all operation, or on an
application-by-application basis.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Feb 28 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1482
by: webtrack+googlegroups | last post by:
I'm trying automate a mail merge in VB.Net as a spike/proof-of-concept. The resulting mail merge document should look very roughly like this: <<Customer FullName>> <<Customer Address>> Dear <<Customer FullName>>, Your details are as follows: (table below idealily has a single row
1
3170
by: Morris | last post by:
Does anyone know whether it is possible to effect a mail merge to MSWord using VBScript in an asp file? I know it is possible to produce a doc file and force a download using Response.ContentType = "application/msword" Response.AddHeader content-disposition","attachment;filename=myfile.doc" but can I interate through a bunch of records and produce, say, a separate invoice for each one by merging? I know how to iterate through the...
2
3251
by: William Wisnieski | last post by:
Hi Everyone, Access 2000 I have some code behind a button that performs a word merge with a query data source. The merge works fine. But what I'd like to do somehow is after the merge is generated (or before), assign the current date to the field in the main table the query data source is based on. Is this even possible? If so, how could I do it? Here is the code that works so far:
3
3669
by: Shyguy | last post by:
I have a MS Word Merge letter that is based on a query. I set up a macro to run the query and then open Word and the merge letter. Word open fine but it can't find the letter. I used RunAPP and put the following in the cammand line box. \Winword.exe \Documentname.doc Any help greatly appreciated as always..
9
4325
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access application as the data source, and then performs a merge. Everything works fine. However, when a user uses it in Access 2002 and Word 2002, an extra instance of the Access application is opened and remains open at the end. Sometimes it remains open
1
7969
by: Peter Zausch | last post by:
Hello, is it possible to merge cells in a datagrid ? In the MS Flexgrid it was possible if cells have the same content. In the datarid i did not found any corresponding function. Regards Peter
9
20871
by: DraguVaso | last post by:
Hi, I have two DataTables (our DataViews or whatever that will suit the best for the solution). I want to merge these two DataTables the fastest as possible, but they have to be merged one table after the others: First all the recors of DataTable1, and afterwarths the records of DataTable2. Does anybody has any idea how to do this? The purpose it that it goes as fast as possible! DataTable2 can have up to 15.000 records, DataTable1...
4
1692
by: phil2phil | last post by:
hi, i wanted to know if it's possible to build an asp.net mail to automate mail merge with ms word documents. i already have the ms word document created with the merge fields, currently we go through the mail merge wizard to select a datasource to merge it with, but i wanted to create a page with buttons, selecting a certain button would cause the document to open using a certain datasource, everything would be merged and ready. is...
2
4168
by: JK | last post by:
I saw Danny Lesandrini's article on Database Journal (http://www.databasejournal.com/features/msaccess/article.php/2236471) on how to merge tables from identical databases. This is exactly what I'm trying to do (we have 3 field offices and want to merge all of their data into one database so we can report out on all three), but instead of doing it by hand, I want to write code so a user can just click a button and it will merge the three...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10438
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
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
10001
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
9042
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...
0
6780
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
5437
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2920
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.