Skip to main content

Module parse

Module parse 

Source
Expand description

Simple XML parsing utilities for extracting content and attributes.

These functions operate on XML strings and provide basic extraction capabilities without requiring a full XML parser. They are designed for the structured XML used in LLM prompts, which tends to be well-formed and predictable.

For complex XML parsing needs, consider using a full parser like quick-xml.

Enums§

XmlError
Error type for XML parsing operations.

Functions§

extract_all_tag_contents
Extracts all occurrences of a tag’s text content.
extract_attr
Extracts the value of an attribute from the first occurrence of a tag.
extract_raw_inner_xml
Extracts the raw (unprocessed) inner XML of a tag, including nested tags.
extract_tag_content
Extracts the text content of the first occurrence of a tag.
has_tag
Checks if a specific tag exists in the XML string.

Type Aliases§

Result