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

feat(cruby): support line numbers larger than a short #2309

Merged
merged 1 commit into from Aug 14, 2021

Conversation

flavorjones
Copy link
Member

What problem is this PR intended to solve?

As noted in #1493, #1617, #1505, #1003, and #533, libxml2 has not historically supported line numbers greater than a short int. Starting in libxml v2.9.0, setting the parse option BIG_LINES would allow tracking line numbers in longer documents.

Specifically this PR makes the following changes:

  • set BIG_LINES parse option by default which will allow Node#line to return large integers
  • allow Node#line= to set large line numbers on text nodes

Fixes #1764

Have you included adequate test coverage?

Yes!

Does this change affect the behavior of either the C or the Java implementations?

JRuby's Xerces-based implementation did not suffer from this particular shortcoming, although its line number functionality is questionable in other ways (see #2177 / b32c875).

- set BIG_LINES parse option by default which will allow Node#line to return large integers
- allow Node#line= to set large line numbers on text nodes

Fixes #1764, #1493, #1617, #1505, #1003, #533
@svoop
Copy link
Contributor

svoop commented Nov 24, 2021

@flavorjones I just came across this problem parsing an aeronautical XML file which counts a whopping 581857 lines. For audits, I have to reference the source node lines, so short doesn't really cut it. Big thanks for this PR! (And hope a fresh release will be cut soonish.)

@flavorjones
Copy link
Member Author

@svoop Yes, a new release will be out in the next week or two at most. (I want one in before we introduce Ruby 3.1 support.)

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.

investigate using XML_PARSE_BIG_LINES to tell libxml2 to track line numbers bigger than a short int
2 participants