473,386 Members | 1,644 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,386 software developers and data experts.

Merging/Linking XML files?

I have an XML document that is linked to other document and I can't figure out what the best way to try and merge them before query qith an XpathNavigator.

Simple example...a root xml document contains the root folder that can contain items and other folders. The other folders can either live in the root document or be in other xml files completely (to make it easier for multiple developers/processes to work on the data at the same time.)

I think the developer that was doing it before was using xlink or xpointer to see if the folder had an href attribute and then called some script to open the document and merge it with the parent creating one big tree (to query later).

Does anyone know what the best way to do this in .Net would be? I think i could do it running the intial file through XSLT and use the document() function but I'm wondering if there is a better way to do this.

Thanks,

Cy Huckaba
Austin, TX
rootFolder.xml ******************

<folder name="rootFolder">
<item name="a" />
<item name="b" />
<item name="c" />

<folder name="thingys">
<item name="ta" />
<item name="tb" />
</folder>

<folder name="widgets" href="widgets.xml"></folder>

<item name="d" />

</folder>

widgets.xml *****************************

<item name="wa" />
<item name="wb" />
<item name="wc" />

<folder name="widgets">
<item name="wwa" />
<item name="wwb" />
</folder>

<item name="wd" />
Nov 11 '05 #1
2 3569
Cy Huckaba wrote:
I have an XML document that is linked to other document and I can't
figure out what the best way to try and merge them before query qith an
XpathNavigator.

Simple example...a root xml document contains the root folder that can
contain items and other folders. The other folders can either live in
the root document or be in other xml files completely (to make it easier
for multiple developers/processes to work on the data at the same time.)

I think the developer that was doing it before was using xlink or
xpointer to see if the folder had an href attribute and then called some
script to open the document and merge it with the parent creating one
big tree (to query later).

Does anyone know what the best way to do this in .Net would be? I think
i could do it running the intial file through XSLT and use the
document() function but I'm wondering if there is a better way to do this.


There is standard way of doing that - XInclude [1]. Then you can have the
following in your document:
<xi:include href="widgets.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
This will include the whole widgets.xml, or
<xi:include href="widgets.xml#xpointer(//folder[@name='widgets'])"
xmlns:xi="http://www.w3.org/2001/XInclude"/>
to include only specified elements.
The plumbing to process it under .NET you can find at GotDotNet, in
XInclude.NET workspace [2]. It provides XIncludingReader class, which
implements XmlReader so can be used everywhere. Just read your XML via this
reader and don't care about underlying including and merging.

[1] http://www.w3.org/TR/xinclude
[2]
http://gotdotnet.com/Community/Works...9-6c42947b04a8
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
Thanks Oleg, I'm looking into it now.

Also, I liked your Extreme XML article on MSDN. Nice to see that authors are
still helping with the newgroups.

Thanks again,

Cy

"Oleg Tkachenko" <oleg@NO_SPAM_PLEASEtkachenko.com> wrote in message
news:#Y**************@tk2msftngp13.phx.gbl...
Cy Huckaba wrote:
I have an XML document that is linked to other document and I can't
figure out what the best way to try and merge them before query qith an
XpathNavigator.

Simple example...a root xml document contains the root folder that can
contain items and other folders. The other folders can either live in
the root document or be in other xml files completely (to make it easier
for multiple developers/processes to work on the data at the same time.)

I think the developer that was doing it before was using xlink or
xpointer to see if the folder had an href attribute and then called some
script to open the document and merge it with the parent creating one
big tree (to query later).

Does anyone know what the best way to do this in .Net would be? I think
i could do it running the intial file through XSLT and use the
document() function but I'm wondering if there is a better way to do this.
There is standard way of doing that - XInclude [1]. Then you can have the
following in your document:
<xi:include href="widgets.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
This will include the whole widgets.xml, or
<xi:include href="widgets.xml#xpointer(//folder[@name='widgets'])"
xmlns:xi="http://www.w3.org/2001/XInclude"/>
to include only specified elements.
The plumbing to process it under .NET you can find at GotDotNet, in
XInclude.NET workspace [2]. It provides XIncludingReader class, which
implements XmlReader so can be used everywhere. Just read your XML via this
reader and don't care about underlying including and merging.

[1] http://www.w3.org/TR/xinclude
[2]

http://gotdotnet.com/Community/Works...e8-cb4b-47c4-a
9d9-6c42947b04a8 --
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #3

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

Similar topics

15
by: Rob Ratcliff | last post by:
I'm compiling the latest version of a CORBA ORB called MICO on a Cray X1. It makes heavy use of templates and namespaces. Up until the link step, the C++ source code compiled flawlessly. But, when...
7
by: Steven T. Hatton | last post by:
Is there anything that gives a good description of how source code is converted into a translation unit, then object code, and then linked. I'm particularly interested in understanding why putting...
3
by: Mike | last post by:
Hi! I also asked this question in C# group with no results: I have 2 datasets loaded with data from two xml files having the same schema. The files contain data from yesterday and today. I'd...
2
by: Nikhil Prashar | last post by:
I'm trying to merge two XML files that have the same structure but not necessarily the same nodes in the same order. I've tried opening the files as datasets and using the DataSet.Merge() function,...
5
by: Brian | last post by:
I need to import data from 720 csv files into an Access database so I can do some editing prior to loading into a SQL Server. These files came from data output from a mainframe on a monthly basis....
10
by: n o s p a m p l e a s e | last post by:
Is it possible to merge two DLL files into one? If so, how? Thanx/NSP
1
by: adamrace | last post by:
Hi, I've got two excel files, one has a list of products and their current prices and they all have a product ID, I have another file with a list of price's that need updating. I was wondering...
0
by: veer | last post by:
Hello sir. I am making a program on merging in Visual Basic. The program is that I have a folder which is not on my hard drive contain 80 Mdb files and each Mdb file contains two tables. I want to...
0
by: Albert-jan Roskam | last post by:
Hi John, Thanks! Using a higher xlrd version did the trick! Regarding your other remarks: -yep, input files with multiple sheets don't work yet. I kinda repressed that ;-) Spss outputs only...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...

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.