Function: parseXml()
ts
function parseXml(text, options?): XmlElement;Defined in: netconf/src/xml/parse.ts:69
Parse a complete XML document into an XmlElement.
The text is read once, straight into the element tree. Well-formedness is enforced: a single root, no content outside it, only the predefined entities, and only character references to legal XML characters. XML end-of-line handling and attribute-value normalisation are applied. On top of that:
- Any DOCTYPE is rejected, which rules out XXE and entity-expansion attacks.
- Namespace prefixes are resolved to URIs; unbound prefixes are errors.
- Depth and node-count limits (XmlParseLimits) are checked before the document is parsed, so an over-limit document never allocates a tree.
Parameters
text
string
options?
XmlParseOptions = {}
Returns
Throws
XmlError