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

Standalone does not parse correctly. #5

Open
aleshaleksey opened this issue Jan 16, 2024 · 0 comments
Open

Standalone does not parse correctly. #5

aleshaleksey opened this issue Jan 16, 2024 · 0 comments

Comments

@aleshaleksey
Copy link

The standalone="yes" or standalone="no" clause of the xml header (Prolog) was broken in two places.

The Prolog expected standalone: Option<String>, but Document::new expected it as Option<bool>, which means that if you write a standalone attribute(?), it will never work.

The solutions are to change either change it to Option<bool> in Prolog and adjust the parser accordingly (chosen solution), or use Option<String> in Document::new, which has the problem that things other than "yes" or "no" need to be handled.

Likewise there is a problem with with the actual:

wr!(buf, " standalone={}", if standalone { "yes" } else { "no" });

in Document::new. It produces incorrect xml without the quotations and should be:

wr!(buf, " standalone=\"{}\"", if standalone { "yes" } else { "no" });

Again, this is implemented in the fork, but you may wish to re-implement this yourself. (I unfortunately used cargo fmt on the code which seems to not have been put through the formatter...)

All the best.

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

1 participant