in reply to Splitting xml file into multiple files

xml_split
  • Comment on Re: Splitting xml file into multiple files

Replies are listed 'Best First'.
Re^2: Splitting xml file into multiple files
by xmlsql (Novice) on Sep 14, 2009 at 13:52 UTC

    The reason why this was no good and the documentation was lost on me was that it split the large file into individual files but the values of each child element were blank even though in the original large file they were valued.

      Are you seeing an error message when calling xml_split? The &nbspetc actually makes the example XML invalid. You may have non-well-formed XML that is causing the tools to barf.

      -derby
      That means you only tried the first or second example, its the third one you want, as I showed you.
Re^2: Splitting xml file into multiple files
by xmlsql (Novice) on Sep 14, 2009 at 13:05 UTC

    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.

      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 .
      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.