xmlsql has asked for the wisdom of the Perl Monks concerning the following question:
I've read the Twig documentation and Jenda's article but as a newbie I'm still lost. Can any one suggest the code for splitting one xml file into multiple xml files based on a particular element with the name of each new file being the datetime the file was created. I do know how to generate the datetime stamp
One new file needs be created for each <Message> element from the original xml file. Each message section can have different child elements so I need to grab everything between <Message> ... </Message> and write it to a new file. The original xml file has the format :
<?xml version="1.0" encoding="utf-8"?>
<TheRoot>
 <Message>
  <MyNumber>001</MyNumber>
  <Registration>222</Registration>
  <GPS>
   <Year>2009</Year>
  </GPS>
  <LbtSession>
   <Year>2009</Year>
  </LbtSession>
 </Message>
 <Message>
  <MyNumber>887</MyNumber>
  <Registration>333</Registration>
  <Client>None</Client>
  <Type>Position</Type>
 </Message>
 <Message>
 etc...
 </Message>
 <Message>
 etc ...
 </Message>
</TheRoot>
Thank you in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splitting xml file into multiple files
by derby (Abbot) on Sep 14, 2009 at 13:01 UTC | |
|
Re: Splitting xml file into multiple files
by Anonymous Monk on Sep 14, 2009 at 12:48 UTC | |
by xmlsql (Novice) on Sep 14, 2009 at 13:52 UTC | |
by derby (Abbot) on Sep 14, 2009 at 13:59 UTC | |
by Anonymous Monk on Sep 14, 2009 at 14:22 UTC | |
by xmlsql (Novice) on Sep 14, 2009 at 13:05 UTC | |
by Herkum (Parson) on Sep 14, 2009 at 13:25 UTC | |
by Anonymous Monk on Sep 14, 2009 at 13:34 UTC | |
by Anonymous Monk on Sep 14, 2009 at 13:26 UTC |