in reply to Re^3: XML::Twig Stream root children
in thread XML::Twig Stream root children

Unless I'm overlooking something, a new feature could be to have an option to omit the merge file (00) and instead have the root wrapped around each output file, ie foo.xml
<root> <a> <b>Test</b> </a> <aa> <b>Test</b> </aa> </root>
becomes 2 files, foo-01.xml
<root> <a> <b>Test</b> </a> </root>
and foo-02.xml
<root> <aa> <b>Test</b> </aa> </root>

Replies are listed 'Best First'.
Re^5: XML::Twig Stream root children
by mirod (Canon) on Oct 04, 2009 at 20:16 UTC

    I may be overlooking something here. The generated "split files" would consist of the 'a' or 'aa', or whatever other level 1 element. So correct me if I'm wrong, but the only thing missing would be the '<root>' first line and '</root>' last line, right? Adding those to each of the files is left as an exercise to the reader.

Re^5: XML::Twig Stream root children
by Herkum (Parson) on Oct 04, 2009 at 14:02 UTC

    I want to break one huge XML document into multiple stand-alone documents. The application that would use this is not smart enough to to handle 'subdocs'.

    I was also looking at a streaming solution, which is what I assumed twig_handlers would do. The reason is that the document I want to break is 500MB(don't ask, I did not do it!) and there is no way it will fit into memory.