How to Split a XML file to multiple small XML Files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kb

    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... Any
    help on this will help me a lot. Thank you
    KB

    Source XML document
    --------------------------
    <?xml version="1.0" standalone="yes "?>
    <Synchronizatio nObjectsDocumen t >
    <ApplicationAre a>
    <DocId>dea959 3b-4c60-4c1a-ab7f-004a4e336ac5</DocId>
    <CreationDateTi me>2004-05-13T21:31:48-04:00</CreationDateTim e>
    </ApplicationArea >
    <Data>
    <V_CLI_CLIENT S>
    <V_CLI_CLIENT >
    <ORU_CODE>CLIEN T1</ORU_CODE>
    </V_CLI_CLIENT>
    <V_CLI_CLIENT >
    <ORU_CODE>CLIEN T2</ORU_CODE>
    </V_CLI_CLIENT>
    </V_CLI_CLIENTS>
    </Data>
    </Synchronization ObjectsDocument >

    Should split to two xml documents as below
    --------------------------------------------------
    Document 1:
    --------------------------------------------------
    <?xml version="1.0" standalone="yes "?>
    <Synchronizatio nObjectsDocumen t >
    <ApplicationAre a>
    <DocId>dea959 3b-4c60-4c1a-ab7f-004a4e336ac5</DocId>
    <CreationDateTi me>2004-05-13T21:31:48-04:00</CreationDateTim e>
    </ApplicationArea >
    <Data>
    <V_CLI_CLIENT S>
    <V_CLI_CLIENT >
    <ORU_CODE>CLIEN T1</ORU_CODE>
    </V_CLI_CLIENT>
    </V_CLI_CLIENTS>
    </Data>
    </Synchronization ObjectsDocument >
    --------------------
    Document 2
    --------------------
    <?xml version="1.0" standalone="yes "?>
    <Synchronizatio nObjectsDocumen t >
    <ApplicationAre a>
    <DocId>dea959 3b-4c60-4c1a-ab7f-004a4e336ac5</DocId>
    <CreationDateTi me>2004-05-13T21:31:48-04:00</CreationDateTim e>
    </ApplicationArea >
    <Data>
    <V_CLI_CLIENT S>
    <V_CLI_CLIENT >
    <ORU_CODE>CLIEN T2</ORU_CODE>
    </V_CLI_CLIENT>
    </V_CLI_CLIENTS>
    </Data>
    </Synchronization ObjectsDocument >
  • Cor Ligthert

    #2
    Re: How to Split a XML file to multiple small XML Files

    Hi KB,

    I do not like these classes because you have to write so much for them and
    therfore maybe never used them, however with your problem it would be the
    first one to look for (and most probably use them).

    xmlReader (it reads node by node, attribute by attribute etc)


    and than the XMLwriter



    I hope this helps?

    Cor


    Comment

    Working...