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

Unrecoverable parser error while parsing (valid) XML #94

Closed
mickdekkers opened this issue Aug 7, 2024 · 5 comments
Closed

Unrecoverable parser error while parsing (valid) XML #94

mickdekkers opened this issue Aug 7, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@mickdekkers
Copy link

Hi,

I encountered an error when attempting to parse this XML file: https://github.com/mickdekkers/xrust-parse-issue-repro/blob/main/data/content.xml

As far as I can tell, the file is valid XML. I'm currently migrating my project over to the xrust crate for the XPath features (thanks, by the way!). In my project, I previously used xot and roxmltree before this, so I can confirm those crates do parse this XML file without issue. The online XML validators I found also confirm the file is valid.

I prepared a repo with a minimal reproducible example: https://github.com/mickdekkers/xrust-parse-issue-repro

The error occurs with the code on main as well as dev. The repro points to dev.

Would appreciate it if you could take a look! 😄

Thanks!

@mickdekkers
Copy link
Author

Hmm, strange... it doesn't seem to be the specific XML file that's the issue here. If I replace the XML file contents in the repro with that of https://github.com/ballsteve/xrust/blob/main/examples/issue-30.xml, I still get the error.

At first glance, my repro code doesn't look meaningfully different from the relevant part of the example code either, so I'm a bit lost 😅

// Parse the XML into a RNode
let root = Rc::new(SmiteNode::new());
xmlparse(root.clone(), srcxml.as_str(), None).expect("unable to parse XML");

@Devasta
Copy link
Collaborator

Devasta commented Aug 7, 2024

Hi @mickdekkers ,

Thank you for the bug report! I'm looking into this now.

@ballsteve
Copy link
Owner

Hi Mick,

I'll take a look at the problem, and will also tag Daniel Murphy on it too.

Cheers, Steve

@ballsteve ballsteve added the bug Something isn't working label Aug 7, 2024
@Devasta
Copy link
Collaborator

Devasta commented Aug 8, 2024

image

The parser is tripping on a byte order mark in the file before the XML declaration.

I'll get a fix in for this in the next release.

@Devasta
Copy link
Collaborator

Devasta commented Jan 10, 2025

This was added to main, ticket can be closed.

@Devasta Devasta closed this as completed Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants