How to Split a XML file to multiple small XML Files

Hello, 

I am trying to split a XML file to multiple small xml files in vb.net and am trying to get the best possible approach to this. Any help on this will be great... Sample example on what I am trying to do...
Source XML document
--------------------------
<?xml version="1.0" standalone="yes"?>
<SynchronizationObjectsDocument >
<ApplicationArea>
<DocId>dea9593b-4c60-4c1a-ab7f-004a4e336ac5</DocId>
<CreationDateTime>2004-05-13T21:31:48-04:00</CreationDateTime>
</ApplicationArea>
<Data>
<V_CLI_CLIENTS>
<V_CLI_CLIENT>
<ORU_CODE>CLIENT1</ORU_CODE>
</V_CLI_CLIENT-V_PHY_ADDRESS_ORU>
</V_CLI_CLIENT>
<V_CLI_CLIENT>
<ORU_CODE>CLIENT2</ORU_CODE>
</V_CLI_CLIENT-V_PHY_ADDRESS_ORU>
</V_CLI_CLIENT>
</Data>
</SynchronizationObjectsDocument>
Should split to two xml documents as below
--------------------------------------------------
<?xml version="1.0" standalone="yes"?>
<SynchronizationObjectsDocument >
<ApplicationArea>
<DocId>dea9593b-4c60-4c1a-ab7f-004a4e336ac5</DocId>
<CreationDateTime>2004-05-13T21:31:48-04:00</CreationDateTime>
</ApplicationArea>
<Data>
<V_CLI_CLIENTS>
<V_CLI_CLIENT>
<ORU_CODE>CLIENT1</ORU_CODE>
</V_CLI_CLIENT-V_PHY_ADDRESS_ORU>
</V_CLI_CLIENT>
</Data>
</SynchronizationObjectsDocument>
<?xml version="1.0" standalone="yes"?>
<SynchronizationObjectsDocument >
<ApplicationArea>
<DocId>dea9593b-4c60-4c1a-ab7f-004a4e336ac5</DocId>
<CreationDateTime>2004-05-13T21:31:48-04:00</CreationDateTime>
</ApplicationArea>
<Data>
<V_CLI_CLIENTS>
<V_CLI_CLIENT>
<ORU_CODE>CLIENT2</ORU_CODE>
</V_CLI_CLIENT-V_PHY_ADDRESS_ORU>
</V_CLI_CLIENT>
</Data>
</SynchronizationObjectsDocument>
0
kumud
6/1/2004 6:47:18 PM
asp.net.visual-basic.net 3721 articles. 0 followers. Follow

1 Replies
709 Views

Similar Articles

[PageSpeed] 10

Read in the records and then just output it as you see fit?  Use the XML objects.

Doesn't that approach go against the design of your XML? You're taking two V_CLI_CLIENT's and removing them from the V_CLI_CLIENTS, which is plural and seems to accept (or desire) multiple CLIENT's.
But, if you really want this approach, then you can parse entire XML document and use a for loop to write back a new document per object (recursively determining the parents each time if not known).
Picky
0
pickyh3d
6/3/2004 4:39:32 AM
Reply:

Web resources about - How to Split a XML file to multiple small XML Files - asp.net.visual-basic.net

Multiple sequence alignment - Wikipedia, the free encyclopedia
A multiple sequence alignment (MSA) is a sequence alignment of three or more biological sequences , generally protein , DNA , or RNA . In many ...

Jakarta attacks: Multiple bombs hit Indonesian capital
ISIS has claimed responsibility for the grenades and crude homemade bombs used to stage a Paris-style attack in a busy business and shopping ...

Jakarta attacks: seven dead in multiple attacks linked to Islamic State
Jakarta is on highest possible alert for terrorism, after multiple explosions hit Central Jakarta on Thursday.

Jakarta attacks: seven dead in multiple attacks linked to Islamic State
Seven people have been killed in a terrorist attack in central Jakarta, including five who are believed to be perpetrators linked to the Islamic ...

iOS 9.3 & watchOS 2.2 betas add ability to pair multiple Apple Watches with an iPhone
... sign that new Apple Watch hardware could be around the corner, Apple's newly released iOS 9.3 beta gives developers the ability to pair multiple ...

Multiple Jobholders Artificially Boost "Full-Time" Employment: Does the Sum of the Parts Equal the Whole ...
... pretty much confirms what I have said about Obamacare boosting part-time employment at the expense of full time jobs. Please consider Multiple ...

Google Seeks Multiple Auto Partners for Self-Driving Car Unit
Google hopes to form partnerships with many automakers and suppliers as it develops self-driving cars to reduce traffic accidents and expand ...

Multiple Explosions, Gunfire Rock Jakarta In Deadly ISIS-Claimed Attack
At least seven people died, including five assailants, a police spokeperson said. Multiple explosions and a gun battle rocked Jakarta, the capital ...

Ramon Foster: Multiple Bengals Spit On Steelers, Not Just Burfict
Steelers OL Ramon Foster joins The Fan Morning Show

The watchOS 2.2 beta lets devs pair multiple devices to one iPhone
... hands on the first beta for watchOS 2.2 today, and it reportedly contains a feature that has us a little confused: the ability to pair multiple ...

Resources last updated: 1/15/2016 7:17:00 AM