<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="extensions" page="functions" subpage="parse"/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: saxon:parse()</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: saxon:parse()"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>saxon:parse()</h1> <p><b>saxon:parse($xml as xs:string) ==> document-node()</b></p> <p>This function takes a single argument, a string containing the source text of a well-formed XML document. It returns the document node (root node) that results from parsing this text. It throws an error if the text is not well-formed XML. Applications should not rely on the identity of the returned document node (at present, if the function is called twice with the same arguments, it returns a new document node each time, but this may change in future).</p> <p>This function is useful where one XML document is embedded inside another using CDATA, or as an alternative way of passing an XML document as a parameter to a stylesheet.</p> <p>A dynamic error is reported if the supplied string is not well-formed (and namespace-well-formed) XML. An XML declaration may be included, but is not required: if it is present, the encoding declaration will be ignored, since the document is supplied in character form rather than in binary.</p> <p>The XML parser that is used will be the one nominated to the Saxon <code>Configuration</code> as the parser for source documents. Validation against schemas or DTDs, and whitespace stripping, will take place according the settings in the <code>Configuration</code> object; if called from XSLT, the <code>xsl:strip-space</code> and <code>xsl:preserve-space</code> settings in the stylesheet are also taken into account.</p> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="parse-html.xml">Next</a></p> </td> </tr> </table> </body> </html>