Files
libfreemkv/docs/labels-xml.md
T
Matthew Jackson 6e14fc0c0c libfreemkv: 1.7.0 groundwork — sector-recycle soundness + CI hardening
Security
- Remove the unsafe Vec::set_len over recycled sector buffers — UB reachable
  from safe code (GHSA-j8ww-f5fg-9pmh, low). Uses Vec::resize; pooling unchanged.

CI / tooling
- clippy on stable with the MSRV single-sourced from Cargo.toml; cargo-deny
  dependency-audit gate with first-party git sources allowed (#15); audience-based
  comment-guard (#17).

Docs
- README (keydb ownership, BD-J parser count), drive-access transport/reset
  notes, mux timeline module-doc links.
2026-09-02 12:40:55 -07:00

27 lines
1.3 KiB
Markdown

# src/labels/xml.rs
Tolerant XML scraping helpers — promoted from two near-duplicate hand-rolls
in `paramount.rs` (attribute extraction) and `criterion.rs` (tag-text
extraction).
These are NOT a full XML parser. They handle the subset of XML the BD-J
authoring tools we've seen actually emit: ASCII tag/attr names, no entity
references inside label strings, optional XML namespaces. Hardening goals
over the prior `find("<tag>")` / `find(r#"name=""#)` matchers:
1. **Case-insensitive** tag and attribute names — vendors casing is
inconsistent across authoring-tool revisions.
2. **Namespace-aware** — strip an optional `ns:` prefix so `<ns:playlist>`
and `<playlist>` both match.
3. **Whitespace-tolerant** — multiple/tab/newline characters around `=`
between attribute name and value; whitespace inside the opening tag.
4. **Quote-style tolerant** — both `"value"` and `'value'`.
5. **Self-closing tag handling** — `<tag />` and `<tag/>` both work;
`text()` returns `Some("")` for empty content.
Out of scope (intentionally simple): XML entity decoding (`&amp;`, `&lt;`,
etc.), CDATA sections, comments, processing instructions, DTD
declarations. None of the BD-J authored disc data we've observed
exercises any of those — labels are plain ASCII/Latin-1 in attribute
values.