473,804 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

merging 2 xml into 1

Hi,

I have one xml looking like this:

=============== ==========
<video>
<shot id="1">
<timestampbegin >000030.90</timestampbegin>
<feature>blabla </feature>
<timestampbegin >000045.20</timestampbegin>
</shot>
<shot id="2">
.....
</video>
=============== ==========

Another xml gives simple information about the clustering of video shots
into scenes looking like that:

=============== ==========
<video>
<scene id="1">
<shot id="1"></shot>
<shot id="4"></shot>
<shot id="5"></shot>
</scene>
<scene id="2">
<shot id="2"></shot>
<shot id="3"></shot>
<shot id="6"></shot>
<shot id="7"></shot>
</scene>
.....
</video>
=============== ==========

I wish to merge both XML into one like:

=============== ==========
<video>
<scene id="1">
<shot id="1">
<timestampbegin >000030.90</timestampbegin>
<feature>blabla </feature>
<timestampbegin >000045.20</timestampbegin>
</shot>
<shot id="4">
............... ........
</shot>
<shot id="5">
............... .......
</shot>
</scene>
<scene id="2">
<shot id="2"> ............... ............... . </shot>
<shot id="3"> ............... ............... . </shot>
<shot id="6"> ............... ............... . </shot>
<shot id="7"> ............... ............... . </shot>
</scene>
........
</video>
=============== ==========

Does anybody know how this kind of simple merging can be done?? using
simple perl with XML::simple or xerces or xalan???

thanks for any hints,

Maël
Jul 20 '05 #1
1 1969
Mael Guillemot wrote:
I have one xml looking like this:

=============== ==========
<video>
<shot id="1">
<timestampbegin >000030.90</timestampbegin>
<feature>blabla </feature>
<timestampbegin >000045.20</timestampbegin>
</shot>
<shot id="2">
....
</video>
=============== ==========

Another xml gives simple information about the clustering of video shots
into scenes looking like that:

=============== ==========
<video>
<scene id="1">
<shot id="1"></shot>
<shot id="4"></shot>
<shot id="5"></shot>
</scene>
<scene id="2">
<shot id="2"></shot>
<shot id="3"></shot>
<shot id="6"></shot>
<shot id="7"></shot>
</scene>
....
</video>
=============== ==========

I wish to merge both XML into one like:

=============== ==========
<video>
<scene id="1">
<shot id="1">
<timestampbegin >000030.90</timestampbegin>
<feature>blabla </feature>
<timestampbegin >000045.20</timestampbegin>
</shot>
<shot id="4">
............... .......
</shot>
<shot id="5">
............... ......
</shot>
</scene>
<scene id="2">
<shot id="2"> ............... ............... . </shot>
<shot id="3"> ............... ............... . </shot>
<shot id="6"> ............... ............... . </shot>
<shot id="7"> ............... ............... . </shot>
</scene>
.......
</video>
=============== ==========

Does anybody know how this kind of simple merging can be done?? using
simple perl with XML::simple or xerces or xalan???


XSLT looks like a good choice for this problem (of course you can do this in
Perl as well by parsing the documents and processing the document trees in
Perl).

I would recommend the following approach: Use the second document (scenes)
as your primary document, process each scene in sequence and pull in shot
information from the other file using the document() function, something
like

<xsl:copy-of select="documen t('shots.xml')/video/shot[@id = $thisid]" />

--
Klaus Johannes Rusch
Kl********@atme dia.net
http://www.atmedia.net/KlausRusch/
Jul 20 '05 #2

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

Similar topics

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
1546
by: Klatuu | last post by:
Whew, I've struggled my way through figuring out how to use XML to transport data..now I can imagine what having a baby is like :) But, I'm stuck now. I generate the XML (single table, no indexes) and populate a dataset using READXML. I then merge the contents of that DS (call it DS1) with a second DS (call it DS2) that I've created on the form that will be used to process the data transfer. I did that so my SQL would be generated (I...
3
1890
by: Patrick | last post by:
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?
2
5563
by: Emmett Power | last post by:
Hi, I have an Access table with a number of records which refer to the same person but with data in different fields. So for example the table would look like this: Name..............Field 1...................Field 2 Fred Smith........Red John Brown........Blue Fred Smith...................................Truck
1
4965
by: svdh | last post by:
I have posed a question last saturday and have advanced alot in the meantime. But I am still not there Problem is that I try to merging various fields from various tables in one document in Word 1. Query..I want to keep the fields seperatred. I do not want to sent on field with all accumulated languages from one person to Word. Each language should appear in the document in a separate cell Cross tables are not delivering the result I...
0
1156
by: Naresh Narwani | last post by:
Problem Summary: Merging two different web applications into one create a problem for User Controls. Reason for merging two different Web Application: To share non serializable object information between the Web applications. Problem Statement: Suppose I have two different web applications WebApp1 and WebApp2, both of them have the
2
1190
by: Ponnurangam | last post by:
Hi, I have created two styles from cssclass and merged first one with the second one. I then used the style for an Item. The styles are not merging. Here is the code that I used Dim mystyle1, mystyle2 As System.Web.UI.WebControls.Style
2
2430
by: Dave Taylor | last post by:
Is there a decent explanation of how menu merging with MDI forms work in VB.NET? I've read through the online help and it still seems that whenever I change menus around or whatever, it breaks everything. VB6, as repetitive as it was to retype menus, was at least consistent. It seems that VB.NET throws menu items wherever it feels like.
7
1772
by: Jon Vaughan | last post by:
I have 2 datasets , one returned as a dataset from a webservice and one created client side form the same stored procedure that is returned from the webservice. I then try and merge the data, but they dont seem to merge. When I return a single table , this method works fine, but im returning 3 tables and the merge isnt happening. Is there anyway to find out how I can why a merge isnt occuring, as the merge doesnt return any errors,
2
1362
by: Tom Costanza | last post by:
For the life of me, I can't seem to merge main menu items from child to parent with MDI forms. I can merge sub-menus, but not main menu items. So I have a parent form with: File Windows Help And a child form with: Edit View And when the child form is displayed, I want the menu to be:
0
9711
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
10595
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
10343
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
9169
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
7633
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
6862
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();...
1
4306
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
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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.