remuslazar / node-xmlsplit

Split large XML files into smaller chunks, uses Node.js Stream API
MIT License
18 stars 6 forks source link

Comments results in invalid XML fragments #2

Closed marcelrassinger closed 8 years ago

marcelrassinger commented 8 years ago

To reproduce run

node testXMLSplit.js --tag book order.xml

Files are in the attached zip file.

Regards, Marcel

bug.zip

marcelrassinger commented 8 years ago

Sorry, I forgot: node version is 4.2.6

remuslazar commented 8 years ago

@marcelrassinger v1.2.5 (already pushed to the npm registry, see #3) should fix it. Could u please confirm that, so I can close this issue? Thanks!

marcelrassinger commented 8 years ago

It works! Thank you very much for the quick fix.

However, I run immediately in another bug: if you split the attached file by “book” then you get an invalid xml as second split. The reason is probably that I have a “book” element nested in another book. So a stack counter or something similar might get confused. I agree, the example is a little bit silly, but in the original huge products file the recursion makes sense.

Shall I open another bug?

Regards Marcel

On 09 Feb 2016, at 12:58, Remus Lazar notifications@github.com wrote:

@marcelrassinger https://github.com/marcelrassinger v1.2.5 (already pushed to the npm registry, see #3 https://github.com/remuslazar/node-xmlsplit/pull/3) should fix it. Could u please confirm that, so I can close this issue? Thanks!

— Reply to this email directly or view it on GitHub https://github.com/remuslazar/node-xmlsplit/issues/2#issuecomment-181834973.

remuslazar commented 8 years ago

@marcelrassinger the current program logic assumes that the outer tag is kinda uniq and will not occur in the inner XML. Mainly for performance reasons the xml parsing being done quite "rude".. but I agree, this should be fixed.

Could u please fill another issue?