# parse-xml

This function takes as input an XML document represented as a string, and returns the document node at the root of an XDM tree representing the parsed document.

parse-xml($arg as xs:string) → document-node(element(*, xs:untyped))

Arguments
| $arg | xs:string | The lexical XML string to be parsed as a document
Result | document-node(element(*, xs:untyped))

parse-xml($arg as xs:string, $baseURI as xs:string) → document-node(element(*, xs:untyped))

Arguments
| $arg | xs:string | The lexical XML string to be parsed as a document
| $baseURI | xs:string | The base URI property of the constructed document
Result | document-node(element(*, xs:untyped))

Links to W3C specifications

Namespace: http://www.w3.org/2005/xpath-functions

Applies to: XPath 3.0, XSLT 3.0, XQuery 3.0 (if enabled in Saxon: requires Saxon-PE or Saxon-EE)

XPath 3.0 Specification

Notes on the Saxon implementation

Newly implemented in Saxon 9.3, provided XPath 3.0 is enabled; replaces the extension function `saxon:parse` which is retained for the time being.

Next