std::encoding::xmlXML parsing and manipulation.
Parse XML strings into node trees, inspect elements, extract attributes and text content, and serialize back to XML text.
import std::encoding::xml;
fn main() {
let root = xml.parse("<book><title>Hew Guide</title></book>");
let title = root.get_child(0);
println(title.get_text());
title.free();
root.free();
}
to_stringSerialize a Node tree back to an XML string.
get_attributeGet an attribute value from a node. Returns empty string if not found.
get_textGet the concatenated text content of a node and its descendants.
NodeAn opaque XML node.
Represents either an element (with tag, attributes, and children) or a
text node. Created by xml.parse(s) or by navigating into a parsed
tree. Must be freed with free() when no longer needed.
NodeMethodsMethods available on an XML Node.
Serialize the node tree back to an XML string.
Get the tag name of an element node. Returns empty for text nodes.
Get an attribute value by name. Returns empty string if not found.
Get the number of child nodes.
Get a child node by index. Returns a new Node that must be freed.
Get the concatenated text content of this node and its descendants.
Return 1 if this is an element node, 0 if text, -1 if null.
Release the node resources.