Groups | Blog | Home
all groups > dotnet xml > december 2005 >

dotnet xml : Merging Few XML


paolol
12/6/2005 2:19:03 PM
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,
Pascal Schmitt
12/6/2005 6:34:58 PM
Hello!

[quoted text, click to view]

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...


--
paolol
12/7/2005 9:33:12 AM
Pascal Schmitt ha scritto:
[quoted text, click to view]
Thanks I will try :)
AddThis Social Bookmark Button