473,395 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Merging Few XML

Hi, I need to merge few XML DB file in one big XML, nay easy way biside
reading one by one and writing a new big one ??
Thanks,
Paolol
Dec 6 '05 #1
2 944
Hello!
Hi, I need to merge few XML DB file in one big XML, nay easy way biside
reading one by one and writing a new big one ??


You could use XSLT and its document()-function, maybe something like
this (untested, possibly wrong)

<transform xmlns="..." xmlns:o="out">
<template match="/">
<o:bigfile>
<for-each select="/files/file">
<copy-of select="document(.)/root/node()" />
</for-each>
</o:bigfile>
</template>
</transform>

input:
<files>
<file>foo.xml</file>
<file>bar.xml</file>
</files>

foo.xml:
<root xmlns="foo">
<content>
<of the="file"/>
</content>
</root>

bar.xml:
<root xmlns="bar">
<bar/>
</root>

output, maybe:
<bigfile xmlns="out" xmlns:f="foo" xmlns:b="bar">
<f:content>
<f:of the="file" />
</f:content>
<b:bar />
</bigfile>

If you really want to merge the files, not just concat them, it will
become more difficult...
--
Pascal Schmitt
Dec 6 '05 #2
Pascal Schmitt ha scritto:
Hello!
Hi, I need to merge few XML DB file in one big XML, nay easy way
biside reading one by one and writing a new big one ??

You could use XSLT and its document()-function, maybe something like
this (untested, possibly wrong)

<transform xmlns="..." xmlns:o="out">
<template match="/">
<o:bigfile>
<for-each select="/files/file">
<copy-of select="document(.)/root/node()" />
</for-each>
</o:bigfile>
</template>
</transform>

input:
<files>
<file>foo.xml</file>
<file>bar.xml</file>
</files>

foo.xml:
<root xmlns="foo">
<content>
<of the="file"/>
</content>
</root>

bar.xml:
<root xmlns="bar">
<bar/>
</root>

output, maybe:
<bigfile xmlns="out" xmlns:f="foo" xmlns:b="bar">
<f:content>
<f:of the="file" />
</f:content>
<b:bar />
</bigfile>

If you really want to merge the files, not just concat them, it will
become more difficult...

Thanks I will try :)
Concat is fine :)
Dec 7 '05 #3

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

Similar topics

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: 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...
3
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,...
2
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
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...
0
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...
2
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...
2
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...
7
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...
2
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.