You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
xml: parse decodes XML entities twice (and inside CDATA), and stringify leaves < unescaped in attributes #130
@libs/xml 8.x decodes XML entities a second time during parse (including inside CDATA) and does not escape < in attribute values during stringify, breaking stringify -> parse round-tripping under default options.
1. Double entity decoding (and CDATA decoding) in parse
(@libs/xml@8.0.1/wasm/parse and @std/xml return & A and @a: "<" for the first input.) @std/xml already decodes character and predefined entity references while leaving CDATA literal, so running revive with options.revive.entities ??= true in @libs/xml/_parser.ts decodes the already-decoded strings again.
<r a="x<y">1</r>
error: Uncaught (in promise) XmlSyntaxError: Cannot use '<' in attribute value at line 1, column 8
Expected: <r a="x<y">1</r>, which parses back to { r: { "#text": "1", "@a": "x<y" } } (< is disallowed in attribute values per https://www.w3.org/TR/xml/#NT-AttValue). xml_attributes in @libs/xml/stringify.ts escapes ["&", '"', "'"] by default, omitting "<".
Activity