how to convert XML document to several XML documents in a new format

Discussion in 'XML' started by enyetor@gmail.com, Apr 21, 2005.

  1. Guest

    I'm migrating data into a content management system and in order to use
    the import tool provided I need to change the format of a large xml
    file and convert each entry to a seperate xml file.

    This is what I have now:


    <?xml version="1.0" encoding="UTF-8" ?>

    <dataroot xmlns:eek:d="urn:schemas-microsoft-com:eek:fficedata"
    generated="2005-04-18T12:05:51">
    <Checklist>
    <ID>1</ID>
    <Category>stuff</Category>
    <Type>stuff</Type>
    <Item>stuff</Item>
    <Steps>stuff</Steps>
    </Checklist>
    <Checklist>
    <ID>2</ID>
    <Category>stuff</Category>
    <Type>stuff</Type>
    <Item>stuff</Item>
    <Steps>stuff</Steps>
    </Checklist>
    <Checklist>
    <ID>3</ID>
    <Category>stuff</Category>
    <Type>stuff</Type>
    <Item>stuff</Item>
    <Steps>stuff</Steps>
    </Checklist>
    <Checklist>
    <ID>4</ID>
    <Category>stuff</Category>
    <Type>stuff</Type>
    <Item>stuff</Item>
    <Steps>stuff</Steps>
    </Checklist>
    </dataroot>



    This is what I need each entry to be as a single file:

    <?xml version="1.0" ?>
    <file DocType="TypeName" DocTitle="TITLE:testing 123"
    DocDesc="TITLE:testing 123">
    <section name="Category">
    <![CDATA[
    stuff
    ]]>
    </section>
    <section name="Type">
    <![CDATA[
    stuff
    ]]>
    </section>
    <section name="Item">
    <![CDATA[
    stuff
    ]]>
    </section>
    <section name="SLA">
    <![CDATA[
    stuff
    ]]>
    </section>
    <section name="Troubleshooting Steps">
    <![CDATA[
    stuff
    ]]>
    </section>
    </file>

    I need some direction on how to accomplish this task...
     
    , Apr 21, 2005
    #1
    1. Advertising

  2. Re: how to convert XML document to several XML documents in a newformat

    wrote:

    > I'm migrating data into a content management system and in order to use
    > the import tool provided I need to change the format of a large xml
    > file and convert each entry to a seperate xml file.


    XSLT 1.1 respectively 2.0 can produce multiple output documents so you
    could look at an XSLT processor which implements 1.1 or 2.0 or its own
    extension function to produce multiple output documents.

    Saxon 6.5 implements XSLT 1.1, Saxon 8 implements 2.0, info is here
    <http://saxon.sourceforge.net/>

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Apr 21, 2005
    #2
    1. Advertising

  3. TextDoctor Guest

    If you actually need to perform formatting of the text, try TEXTools.
    It's an inexpensive shareware product designed for heavy-duty text
    processing that might do the trick for you. Instead of declaring
    variables, creating loops, etc., you simply combine filters into a
    "pipe" that, when executed, does all the text processing work for
    you... You can find TEXTools at www.fireflysoftware.com. Best of
    luck!

    Barry Block
    Firefly Software
     
    TextDoctor, May 7, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    392
  2. Timothy Grant
    Replies:
    6
    Views:
    3,375
  3. Replies:
    1
    Views:
    517
    Juan T. Llibre
    Oct 18, 2006
  4. Ralph Amissah
    Replies:
    0
    Views:
    207
    Ralph Amissah
    Nov 20, 2005
  5. Victor \Zverok\ Shepelev

    RDOC: several related modules in several C files

    Victor \Zverok\ Shepelev, Mar 6, 2007, in forum: Ruby
    Replies:
    3
    Views:
    197
    Max Lapshin
    Mar 16, 2007
Loading...

Share This Page