in reply to Re: Splitting xml file into multiple files
in thread Splitting xml file into multiple files

I did read the documentation you pointed on re the comment on xml split prior to posting my question. The documentation was of no help at this point. That was the reason for posting. Can anyone suggest what the code should be?

Thank you inadvance.

  • Comment on Re^2: Splitting xml file into multiple files

Replies are listed 'Best First'.
Re^3: Splitting xml file into multiple files
by Herkum (Parson) on Sep 14, 2009 at 13:25 UTC

    I can understand you being unable to follow the documentation, it is cryptic. However, you should at least try to use it even if you don't understand it. Then you can see what you can learn from it.

    Programming is not all about technical skill and almost nothing runs perfectly on the first go. Sometimes you have to try something just to see what will happen.

      Can you explain how documentation is cryptic?

      I skipped reading DESCRIPTION and just tried all the examples in the documentation

      EXAMPLES xml_split foo.xml # split at level 1 xml_split -l 2 foo.xml # split at level 2 xml_split -c section foo.xml # a file is generated for each sec +tion element # nested sections are split proper +ly
      The 3rd example was what I (or the OP) wanted .
Re^3: Splitting xml file into multiple files
by Anonymous Monk on Sep 14, 2009 at 13:26 UTC
    The code should be xml_split.
    $ cat f.xml <?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> </TheRoot> $ $ xml_split -vc Message f.xml generating main file f-00.xml generating f-01.xml generating f-02.xml $ cat f-00.xml <?xml version="1.0" encoding="utf-8"?> <TheRoot> <?merge subdocs = 0 :f-01.xml?> <?merge subdocs = 0 :f-02.xml?> </TheRoot> $ $ cat f-01.xml <Message> <MyNumber>001</MyNumber> <Registration>222</Registration> <GPS> <Year>2009</Year> </GPS> <LbtSession> <Year>2009</Year> </LbtSession> </Message> $ $ $ cat f-01.xml <Message> <MyNumber>001</MyNumber> <Registration>222</Registration> <GPS> <Year>2009</Year> </GPS> <LbtSession> <Year>2009</Year> </LbtSession> </Message> $
    This is my first time using xml_split.