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

"<tag></tag>" parsed as if it were nothing #16

Open
wilzbach opened this issue Jan 28, 2018 · 0 comments
Open

"<tag></tag>" parsed as if it were nothing #16

wilzbach opened this issue Jan 28, 2018 · 0 comments

Comments

@wilzbach
Copy link
Member

From @jmdavis on January 6, 2017 8:20

This test fails

auto xml = `<?xml version="1.0" encoding="UTF-8"?><tag></tag>`;
auto domBuilder = lexer(xml).parser().cursor().domBuilder();
domBuilder.buildRecursive();
auto dom = domBuilder.getDocument();
assert(dom.childNodes.length == 1); // length is actually 0

This succeeds

auto xml = `<?xml version="1.0" encoding="UTF-8"?><tag/>`;
auto domBuilder = lexer(xml).parser().cursor().domBuilder();
domBuilder.buildRecursive();
auto dom = domBuilder.getDocument();
assert(dom.childNodes.length == 1);

as does this

auto xml = `<?xml version="1.0" encoding="UTF-8"?><tag>foo</tag>`;
auto domBuilder = lexer(xml).parser().cursor().domBuilder();
domBuilder.buildRecursive();
auto dom = domBuilder.getDocument();
assert(dom.childNodes.length == 1);

Also, adding attributes to the opening tag in the first example has no effect. It still fails.

So, something funny is going on when there's an open and closing tag with nothing between them, and attributes don't seem to have any impact on what's going on.

Copied from original issue: lodo1995/experimental.xml#41

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