473,666 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="rootFolde r">
<item name="a" />
<item name="b" />
<item name="c" />

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

<folder name="widgets" href="widgets.x ml"></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 3585
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.x ml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
This will include the whole widgets.xml, or
<xi:include href="widgets.x ml#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 XIncludingReade r 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_P LEASEtkachenko. com> wrote in message
news:#Y******** ******@tk2msftn gp13.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.x ml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
This will include the whole widgets.xml, or
<xi:include href="widgets.x ml#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 XIncludingReade r 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
425
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 it tried to link, I got the attached warnings and then an error. Any ideas why the linker wouldn't see the objects in the library? They look like pretty long names, so maybe there is some type of symbol length or mangling issue going on? The...
7
5104
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 normal functions in header files results in multiple definition errors even when include guards are used. -- STH Hatton's Law: "There is only One inviolable Law" KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com Mozilla:...
3
11016
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 like to merge both datasets in such a way that the resulting dataset should have all the today's data overriding yestrerday's data. CATCH: the today's dataset contains only the daily changes (DELTA) and merging should not remove all unchanged...
2
3891
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, but this only "fumbles" the data together and puts children under the wrong parent nodes. How else could I go about merging the files? I'm using C# .NET.
5
3414
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. There are 15 files created each month with each file containing specific data. What I started to do is store the files by year and then by month so I new when the data is based on. I have linked the table to the database and them append the...
10
10054
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
2391
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 what the best way of going about merging the two files together, with the old price and the new price using the ID's. The second file has a list of all the products on their system, the first has just a few of these which are on the other system. If...
0
1341
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 merge all the Mdb files into a new Mdb file using a single execution or in one loop. I have some coding, please correct it or modify. I don't know how to move from one database to another. Set dbparent = Workspaces(0).OpenDatabase(txtparentMDBFile)...
0
2346
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 single-sheet xls files, but I agree it's nicer if the programs works in other cases too. -and no, I don't intend to use data fields. Wouldn't it be easier to convert those to string values if I ever came across them? Thanks again! Albert-Jan
0
8363
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
8883
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
8787
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...
1
8561
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8645
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
7389
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
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
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.