Skip to content

BREAKING(xml): clean up public API ahead of stabilization#7206

Open
tomas-zijdemans wants to merge 3 commits into
denoland:mainfrom
tomas-zijdemans:xml-ready
Open

BREAKING(xml): clean up public API ahead of stabilization#7206
tomas-zijdemans wants to merge 3 commits into
denoland:mainfrom
tomas-zijdemans:xml-ready

Conversation

@tomas-zijdemans

Copy link
Copy Markdown
Contributor

Summary

Cleanup of the @std/xml public API in preparation for a future
stabilization proposal. The goal is to remove surface that should not be
stabilized and fix documentation that did not match actual behavior, so
the API that remains is the API we would commit to at 1.0.0.

Breaking changes

  • Remove unused exported types. The XmlEvent union and its event
    interfaces (XmlStartElementEvent, XmlEndElementEvent, XmlTextEvent,
    XmlCDataEvent, XmlCommentEvent, XmlProcessingInstructionEvent) and
    XmlAttribute were leftovers from a pre-callback event-object design and
    appeared in no public function signature. XmlTokenCallbacks is the
    tokenizer's internal contract and has moved to _tokenizer.ts.
  • Rename XmlDeclarationEvent to XmlDeclaration. It survives only as the
    type of XmlDocument.declaration, so the Event suffix was a misnomer.
  • XmlSyntaxError no longer appends at line 0, column 0 to messages
    when position tracking is disabled. line: 0 is documented as the
    sentinel for "position unknown".

Documentation fixes

  • XmlPosition.offset and XmlSyntaxError.offset are UTF-16 code-unit
    offsets into the input string, not byte offsets.
  • XmlElement.attributes is keyed by the raw qualified attribute name
    (e.g. xlink:href, xmlns:ns), not the local name.
  • XmlEventCallbacks.onDoctype now documents that it only fires when
    disallowDoctype: false is set; under the default, a DOCTYPE throws.

Tests

  • Public-level parseXmlStream() DOCTYPE tests: onDoctype receives name,
    public ID, and system ID; the default rejects DOCTYPE without invoking
    the callback (previously only covered at the internal tokenizer level).
  • Tests for the position-suffix behavior of XmlSyntaxError.

Test plan

  • deno task ok passes locally

This PR was developed with the assistance of an AI agent in Cursor; all
changes were reviewed and verified by me.

@github-actions github-actions Bot added the xml label Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.84%. Comparing base (0e5b1f2) to head (e064d23).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7206   +/-   ##
=======================================
  Coverage   94.83%   94.84%           
=======================================
  Files         617      618    +1     
  Lines       51674    51680    +6     
  Branches     9350     9351    +1     
=======================================
+ Hits        49007    49015    +8     
  Misses       2121     2121           
+ Partials      546      544    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant