Utilities
getText(node: XMLNode): string
Recursively traverses the XML node and its children, collecting all text content. It handles both text nodes and element nodes with children.
For text nodes, it returns the
content
property.For element nodes, it recursively collects text from all child nodes.
If a node has no children, an empty string is returned.
Parameters
node: XMLNode
- The XML node from which to extract text.
Returns
string
- The combined text content of the node and its children.
getRaw(node: XMLNode): string
Returns the raw XML text of an XML node.
Parameters
node: XMLNode
- The XML node to convert to a raw string.
Returns
string
- The raw XML string representation of the node and its children.
Last updated