node-xml
node-xml copied to clipboard
parseString() triggers onEndDocument() on every invocation
The onEndDocument() callback seems to be fired every time the parser reaches the end of available input when working in chunked mode. I would expect it only to be invoked follow a fatal error, if at all, during chunked parsing; there's actually no way for the parser to know if the document has been fully parsed, since there can be trailing comments and/or PIs following the closing tag of the document element. There should probably be a parser.end() API so clients can signal end of input when using chunked parsing.