README

bobzhang/docx2html/xml does not have a README file

#
XmlElement

pub(all) struct XmlElement {
name : String
attributes :
SortedMap
[String, String]
children : Array[XmlNode]
} derive(Eq,
Debug
)

XML element with a name, attributes, and child nodes.

#
XmlElement::descendants_by_tag_name

fn XmlElement::descendants_by_tag_name(self : XmlElement, name : String) -> Array[XmlElement]

Returns descendant elements with the requested tag.

#
XmlElement::elements_by_tag_name

fn XmlElement::elements_by_tag_name(self : XmlElement, name : String) -> Array[XmlElement]

Returns direct child elements with the requested tag.

#
XmlElement::equal

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn XmlElement::equal(XmlElement, XmlElement) -> Bool

#
XmlElement::first

fn XmlElement::first(self : XmlElement, name : String) -> XmlElement?

Returns the first child element with the requested tag.

#
XmlElement::first_or_empty

fn XmlElement::first_or_empty(self : XmlElement, name : String) -> XmlElement

Returns the first matching child text, or an empty string.

#
XmlElement::not_equal

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn XmlElement::not_equal(x : XmlElement, y : XmlElement) -> Bool

#
XmlElement::text

Returns concatenated text content for the XML element.

#
XmlElement::to_repr

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn XmlElement::to_repr(XmlElement) ->
Repr

#
XmlNode

pub(all) enum XmlNode {
XmlElement(XmlElement)
XmlText(String)
} derive(Eq,
Debug
)

Node in the lightweight XML tree.

#
XmlNode::equal

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn XmlNode::equal(XmlNode, XmlNode) -> Bool

#
XmlNode::not_equal

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn XmlNode::not_equal(x : XmlNode, y : XmlNode) -> Bool

#
XmlNode::to_repr

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn XmlNode::to_repr(XmlNode) ->
Repr

#
XmlReadBudget

pub struct XmlReadBudget {
// private fields
}

A cumulative allocation budget shared by one or more XML parses.

Source storage is charged before decoding, and every materialized XML name, attribute value, text/CDATA segment, and element is charged before the parser copies or appends it. Reusing one budget across package parts bounds the aggregate DOM rather than granting every part an independent ceiling.

#
XmlReadBudget::charge_derived_chars

fn XmlReadBudget::charge_derived_chars(self : XmlReadBudget, chars : Int) -> Unit raise
DocxError

Charges a derived string retained by a higher-level XML consumer. Parsers already charge token materialization directly; projections such as indexed structural paths must use this hook before allocating their own copies so they remain inside the same cumulative envelope.

#
XmlSourceEncoding

pub(all) enum XmlSourceEncoding {
Utf8
Utf16LittleEndianWithBom
Utf16BigEndianWithBom
Utf16LittleEndian
Utf16BigEndian
}

The byte encoding used to decode an XML source string. Passing it to read_xml_string_strict_encoded makes the XML declaration part of the strict contract instead of treating it as unaudited metadata. BOMless UTF-16LE and UTF-16BE sources require a matching declaration.

#
collapse_xml_schema_whitespace

fn collapse_xml_schema_whitespace(value : StringView) -> String

Applies the XML Schema whiteSpace=collapse facet: XML whitespace runs become one ASCII space, and leading/trailing runs are removed.

#
read_xml_bytes_limited

fn read_xml_bytes_limited(source : BytesView, budget : XmlReadBudget, namespace_map? : Map[String, String]) -> XmlElement raise
DocxError

Decodes and parses tolerant UTF-8 XML. Source bytes are charged before a String is allocated, so oversized parts fail without a second full payload.

#
read_xml_bytes_limited_with_root_namespace_uri

fn read_xml_bytes_limited_with_root_namespace_uri(source : BytesView, budget : XmlReadBudget, namespace_map? : Map[String, String]) -> (String?, XmlElement) raise
DocxError

Decodes and parses tolerant UTF-8 XML under a cumulative budget, returning both the document element's namespace URI and the canonicalized tree. This preserves the distinction between a namespace-bound QName and an identical literal QName whose prefix is unbound.

#
read_xml_bytes_strict_limited

fn read_xml_bytes_strict_limited(source : BytesView, budget : XmlReadBudget, namespace_map? : Map[String, String]) -> XmlElement raise
DocxError

Decodes and parses strict DTD-free UTF-8 XML under a cumulative budget.

#
read_xml_bytes_strict_mce_limited

fn read_xml_bytes_strict_mce_limited(source : BytesView, budget : XmlReadBudget, application_namespaces : Array[String]) -> XmlElement raise
DocxError

Strictly parses UTF-8 XML, preserves namespace scope long enough to apply ECMA-376 Part 3 Markup Compatibility processing, and returns the processed single-root tree. The markup configuration is empty; callers provide the namespaces their application understands.

#
read_xml_bytes_strict_mce_with_roots_limited

fn read_xml_bytes_strict_mce_with_roots_limited(source : BytesView, budget : XmlReadBudget, application_namespaces : Array[String]) -> (XmlElement, XmlElement) raise
DocxError

Strictly parses UTF-8 XML and returns both the raw document tree and the single root selected by Markup Compatibility. Mutation callers inspect the raw tree before changing preserved bytes, while semantic readers consume the effective tree. Both projections come from one bounded parse.

#
read_xml_string

fn read_xml_string(source : String, namespace_map? : Map[String, String]) -> XmlElement raise
DocxError

Parses XML text into an element.

#
read_xml_string_limited

fn read_xml_string_limited(source : String, budget : XmlReadBudget, namespace_map? : Map[String, String]) -> XmlElement raise
DocxError

Parses tolerant XML while charging a caller-owned cumulative budget. String input is charged in UTF-16 storage units before parsing.

#
read_xml_string_strict

fn read_xml_string_strict(source : String, namespace_map? : Map[String, String]) -> XmlElement raise
DocxError

Parses DTD-free XML 1.0 with Namespaces well-formedness checks enabled.

The regular parser intentionally preserves historical xmldom-compatible recovery behavior for document conversion. Package metadata and mutation gates should use this entry point so malformed XML fails closed.

#
read_xml_string_strict_encoded

fn read_xml_string_strict_encoded(source : String, source_encoding : XmlSourceEncoding, namespace_map? : Map[String, String]) -> XmlElement raise
DocxError

Strictly parses an already decoded XML string and rejects an encoding declaration that contradicts the supplied byte encoding.

#
read_xml_string_strict_encoded_limited

fn read_xml_string_strict_encoded_limited(source : String, source_encoding : XmlSourceEncoding, budget : XmlReadBudget, namespace_map? : Map[String, String]) -> XmlElement raise
DocxError

Strictly parses an already-decoded XML string under a caller-owned cumulative budget while enforcing the declared byte encoding.

#
read_xml_string_strict_limited

fn read_xml_string_strict_limited(source : String, budget : XmlReadBudget, namespace_map? : Map[String, String]) -> XmlElement raise
DocxError

Parses strict DTD-free XML while charging a caller-owned cumulative budget. String input is charged in UTF-16 storage units before parsing.

#
read_xml_string_strict_mce_encoded_limited

fn read_xml_string_strict_mce_encoded_limited(source : String, source_encoding : XmlSourceEncoding, budget : XmlReadBudget, application_namespaces : Array[String]) -> XmlElement raise
DocxError

Strictly parses an already decoded XML string, enforces the declared byte encoding, preserves namespace scope long enough to apply ECMA-376 Part 3 Markup Compatibility processing, and charges the caller-owned cumulative budget. String input is charged in UTF-16 storage units before parsing. The markup configuration is empty; callers provide the namespaces their application understands.

#
read_xml_string_with_root_namespace_uri

fn read_xml_string_with_root_namespace_uri(source : String, namespace_map? : Map[String, String]) -> (String?, XmlElement) raise
DocxError

Parses tolerant XML and also returns the namespace URI that expands the document element's QName. An unprefixed root without a default namespace, or a root whose prefix is unbound, reports None even when its literal name happens to match a caller's canonical prefix.

#
write_xml_fragment

fn write_xml_fragment(element : XmlElement, namespaces? : Map[String, String]) -> String

Serializes one element as a FRAGMENT: no XML declaration, with the given namespace declarations placed on the element itself — the self-contained form the L0 splice contract requires (a fragment's correctness must not depend on the destination document's own bindings).

#
write_xml_fragment_limited

fn write_xml_fragment_limited(element : XmlElement, max_output_bytes~ : Int, namespaces? : Map[String, String]) -> String raise
DocxError

Serializes one XML fragment only after an allocation-free sizing pass has proved that its UTF-8 representation fits max_output_bytes. The sizing pass accounts for escaping and namespace declarations and rejects excessive nesting before the recursive writer runs.

#
write_xml_string

fn write_xml_string(root : XmlElement, namespaces? : Map[String, String]) -> String

Serializes an XML element to text.

#
xml_element

fn xml_element(name : String, attributes? : Map[String, String], children? : Array[XmlNode]) -> XmlElement

Builds an XML element.

#
xml_read_budget

fn xml_read_budget(max_source_units~ : Int, max_tokens~ : Int, max_materialized_chars~ : Int, max_token_chars~ : Int, cancelled? : () -> Bool) -> XmlReadBudget

Builds a cumulative XML read budget. Negative ceilings clamp to zero; a zero ceiling is valid and makes the corresponding first charge fail.

#
xml_text

fn xml_text(value : String) -> XmlNode

Builds an XML text node.