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

Failing test cases related to issue #21 - firstChildWithTag: does not work with 'text' #22

Closed
wants to merge 1 commit into from

Conversation

rhodgkins
Copy link
Contributor

See #21.

Hopefully if the issue can be fixed these test cases can be used to help! I've created an issue and a pull request separately as this pull request does not fix the issue just shows it.

…inding 'text' elements with 'firstChildWithTag'
@rhodgkins
Copy link
Contributor Author

Also I noticed that Travis CI didn't try to build this pull request, and looking at the page, its never built anything, just a heads up if you weren't aware! :)

So the failing cases for the above are in this Travis CI build.

Failing:

  • testSingleElementUsingChildWithTag
  • testTextElementsUsingChildWithTag

Passing:

  • testSingleElementUsingChildWithXPath
  • testTextElementsUsingChildWithXPath

@rhodgkins rhodgkins changed the title Failing test cases related to issue #21 - firstChildWithTag does not work with 'text' Failing test cases related to issue #21 - firstChildWithTag: does not work with 'text' Aug 30, 2014
@mattt
Copy link
Owner

mattt commented Aug 30, 2014

Thanks so much for putting in the effort to send these failing tests. I really appreciate it.

After a big of debugging, I found that (for whatever reason), an element named "<text>" is treated as an XML_TEXT_NODE, rather than an XML_ELEMENT_NODE. Nothing in the XML spec (at least as far as I could find) describes this behavior, and instead appears to be an unfortunate behavior of libxml2.

The first fix I tried was to add a condition to the check in childrenAtIndexes:, to match when an element is XML_TEXT_NODE and also named @"text". Unfortunately, that change breaks a number of other tests. I looked for other options that could have been passed into the initial XML document parsing, but didn't find any leads.

I don't have much bandwidth to pursue this myself, but at this point, I'd try asking on Stack Overflow on the off chance that someone else has run into this, and knows the workaround...

@mattt
Copy link
Owner

mattt commented Oct 5, 2014

After searching on and off for a bit, I've come to the conclusion that this, whether it's a bug in libxml2 or some obscure part of the XML spec, that there is little that can be done with this library to deal with elements named <text>.

If anyone has any ideas, I'd be happy to reopen. But for the time being, this is closed as "won't fix".

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

Successfully merging this pull request may close these issues.

2 participants