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

Capture more of the Document #668

Merged
merged 1 commit into from
Jun 21, 2023
Merged

Capture more of the Document #668

merged 1 commit into from
Jun 21, 2023

Conversation

dubinsky
Copy link
Contributor

@dubinsky dubinsky commented Jun 8, 2023

  • handle Locator2, DTDHandler, DeclHandler, and LexicalHandler DTD and entity methods;
  • introduce DtdBuilder and delegate DTD methods to it;
  • introduce ElementContentModel and delegate parsing of the element content model in the DTD element declarations to it;
  • XMLLoader.loadDocument() returns baseURI, XML version, encoding and standAlone flag, and DTD;
  • tests demonstrating the new returns.

Now that XMLoader returns Document, there is a place to return more information abut the parsed XML document - and this change does that, bringing XMLLoader to parity with the ConstructingParser ; returned now are:

  • document's baseURI (which ConstructingParser never returned and indeed couldn't return);
  • XML version of the document (which ConstructingParser returns correctly only if it is "1.0");
  • standalone status of the document;
  • document's encoding (ConstructingParser seems unable to parse documents encoded in UTF-16);
  • document's DTD (ConstructingParser does not return element and attribute declarations, notations and some entities).

To preserve binary compatibility, parsed DTD is converted (with some loss of fidelity) into pre-existing ContentModel classes, instead of replacing them with the newly-introduced ElementContentModel.
To avoid capturing by the binary compatibility rules, newly introduced classes are package-private.

@SethTisue
Copy link
Member

no objection here — feel free to merge if no other reviewers appear

@dubinsky
Copy link
Contributor Author

feel free to merge if no other reviewers appear

Thank you!

- handle Locator2, DTDHandler, DeclHandler, and LexicalHandler DTD and entity methods;
- introduce DtdBuilder and delegate DTD methods to it;
- introduce ElementContentModel and delegate parsing of the element content model in the DTD element declarations to it;
- XMLLoader.loadDocument() returns baseURI, XML version, encoding and standAlone flag and DTD;
- tests demonstrating the new returns;
@dubinsky dubinsky merged commit 4e20741 into scala:main Jun 21, 2023
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