Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DOCTYPE or ignore it please #24

Closed
notsyncing opened this issue Aug 23, 2015 · 2 comments
Closed

Support DOCTYPE or ignore it please #24

notsyncing opened this issue Aug 23, 2015 · 2 comments

Comments

@notsyncing
Copy link

Hello, I'm using xmldoc to parse XML files and it worked very well!
But I ran into a problem...
when a XML document contains a DOCTYPE tag and there are more than one tag after it, xmldoc will throw an error, like following:

var a = new xmldoc.XmlDocument("<b /><a></a>")
TypeError: Cannot read property '_opentag' of undefined
at Object.parser_opentag as onopentag (/home/sfc/Projects/common-js/node-bubble/node_modules/xmldoc/lib/xmldoc.js:222:41)
at emit (/home/sfc/Projects/common-js/node-bubble/node_modules/xmldoc/node_modules/sax/lib/sax.js:625:33)
at emitNode (/home/sfc/Projects/common-js/node-bubble/node_modules/xmldoc/node_modules/sax/lib/sax.js:630:3)
at openTag (/home/sfc/Projects/common-js/node-bubble/node_modules/xmldoc/node_modules/sax/lib/sax.js:814:3)
at Object.write (/home/sfc/Projects/common-js/node-bubble/node_modules/xmldoc/node_modules/sax/lib/sax.js:1189:26)
at new XmlDocument (/home/sfc/Projects/common-js/node-bubble/node_modules/xmldoc/lib/xmldoc.js:188:15)
at repl:1:9
at REPLServer.defaultEval (repl.js:132:27)
at bound (domain.js:254:14)
at REPLServer.runBound as eval

docs like "" and "" do not produce this error.

Could you please add support for DOCTYPE tags, or just ignore them sliently?
Thank you very much!

using xmldoc 0.3.1 on nodejs 0.12.7

@notsyncing
Copy link
Author

Found problem, XML doesn't support mutiple root elements...
Sorry for disturbing!

@nfarina
Copy link
Owner

nfarina commented Aug 23, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants