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

Would you care to explain? I tried to make it output well-formed fragments. About the only thing I can think of that would trip xml_split would be DTDs with entities, and if you have an example, I would be glad to make it work for you.

Thanks

Replies are listed 'Best First'.
Re^4: XML::Twig Stream root children
by Anonymous Monk on Oct 04, 2009 at 10:51 UTC
    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>

      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.

      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.