Expand description
XML building primitives: tag, escape_xml, and extract_xml_tag_value.
Low-level XML building primitives used throughout the crate.
These utilities are deliberately simple and allocation-efficient: they work
on &str slices and return owned Strings, with no external XML library
dependency.
Enums§
- TagContent
- Content variants for the
tagbuilder function.
Functions§
- clear_
xml_ string - Clean an XML string by removing namespace artifacts, collapsing inter-tag
whitespace, and optionally stripping the
<?xml … ?>declaration. - escape_
xml - Escape special XML characters in text content and attribute values,
replacing
&,<,>,", and'with their XML entity equivalents. - extract_
xml_ tag_ value - Extract the text content of the first occurrence of a simple XML tag in a raw XML string.
- pretty_
print_ xml - Pretty-print an XML string by adding indentation.
- remove_
invalid_ xml_ chars - Remove characters that are invalid in XML 1.0 documents.
- replace_
unacceptable_ characters - Replace characters that are valid in XML but rejected by SEFAZ.
- tag
- Build an XML tag with optional attributes and children.
- validate_
xml - Validate an NF-e XML string by checking for the presence of required tags.