-
Notifications
You must be signed in to change notification settings - Fork 245
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
Parse xml responses files as xml files #209
base: master
Are you sure you want to change the base?
Conversation
@samogot Can you add a test? |
parse_mode = getResponseType(res.headers['content-type']); | ||
try { | ||
if (parse_mode === 'xml') | ||
document = libxml.parseXml(document, {baseUrl: location.href, huge: true}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, was it always throwing on parse errors or is this new with parseXml
?
Can you try adding the XML parse option errors: false
so we can avoid the try/catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Libxmljs docs says that unrecoverable errors are "thrown and need to be caught". I don't know is there any fatal errors in html mode, though. But anyway using try-catch even for html is safer, just in case. Why don't you like it?
Xml throws even with errors: false
. Looks like this option is only about recoverable errors.
For example it fixes interpretation of opening <link> tag in RSS as HTML inline tag <link /> without text content. Also allow to overwrite parsing method.
Xml parsing is more strict and have more unrecoverable errors like absence of root element or multiply root elements.
For example it fixes interpretation of opening tag in RSS as HTML
inline tag without text content.
Also allow to overwrite parsing method.
Fixes #204