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

Unexpected close tag (<link>) #47

Open
jari-codedure opened this issue Jan 13, 2023 · 1 comment
Open

Unexpected close tag (<link>) #47

jari-codedure opened this issue Jan 13, 2023 · 1 comment

Comments

@jari-codedure
Copy link

tXml fails to parse perfectly valid XML like this:

<a><link>foobar</link></a>

I get error "Error: Unexpected close tag" (for the record, fix is to give noChildNodes: [] as option for parse()).

This is kind of a documented feature as documentation describes noChildNodes as "array of nodes, that have no children and don't need to be closed. Default is working good for html." and is given as an example. However, it is surprising that parsing fails if closing tag do exist (not sure but I think link tag can be closed?). It is also surprising that XML parser, by default, fails to parse valid XML even if stated in the documentation if you read far enough especially when everything seems to work at first and then just crashed later on when link tag makes it way to XML.

So I would propose enhancement along the lines:

  1. Make parse() accept end tags for noChildNodes as well, if this is possible
  2. Update documentation so that it is obvious that by default parse() is designed for HTML and may fail with XML
  3. Perhaps even separate functions with different defaults link parseHtml() and parseXml(), this would also help e.g. with Parse special entinties #44 so parseXml and parseHtml would by default decode entities and CDATA while parse() would be backwards compatible

But hey, great parser in any case, worked just fine with a product using Rhino engine blocking access to everything otherwise able to decode XML...

@jari-codedure
Copy link
Author

Ok actually this is too much an duplicate of #39, will close...

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