Skip to main content

process_xincludes

Function process_xincludes 

Source
pub fn process_xincludes(
    doc: &Document,
    opts: &XIncludeOptions,
) -> Result<Document, XmlError>
Expand description

Process every xi:include element in doc, returning a fresh Document in which each include has been replaced by the resolved content. Operates by deep-copying the original tree into a new arena; doc is left untouched.

Errors:

  • XmlError(domain=Io) — resolver refused or file unreadable AND no <xi:fallback> was provided
  • XmlError(domain=Parser) — included XML didn’t parse
  • XmlError(domain=Validation) — cycle detected, depth/byte limit exceeded, or xi:include element used incorrectly (missing href, bad parse= value, etc.)

§API divergence from legacy

The legacy crate::xinclude::process_xincludes mutates its argument in-place. This arena version returns a new Document instead — see the module docs for the reasoning.