Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   how to convert XML document to several XML documents in a new format (http://www.velocityreviews.com/forums/t169193-how-to-convert-xml-document-to-several-xml-documents-in-a-new-format.html)

enyetor@gmail.com 04-21-2005 04:12 PM

how to convert XML document to several XML documents in a new format
 
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:od="urn:schemas-microsoft-com:officedata"
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...


Martin Honnen 04-21-2005 05:07 PM

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


enyetor@gmail.com 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/

TextDoctor 05-07-2005 07:22 PM

Re: how to convert XML document to several XML documents in a new format
 
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



All times are GMT. The time now is 11:14 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.