Changes

Jump to navigation Jump to search
396 bytes added ,  01:22, 3 January 2013
| '''Errors'''
|{{Error|BXHL0001|#Errors}} the input cannot be converted to XML.
|-} | '''==Examples'''== ===Simple Example=== The following query converts the specified string to an XML document node. ;Query:|<pre class="brush:xquery">* {{Code|html:parse("<html></html>")}} returns {{Code|</pre> ;Result:<pre class="brush:xml"><htmlxmlns="http://www.w3.org/1999/xhtml"/>}}* <code/pre===Specifying Options=== The next query creates an XML document without namespaces: ;Query:<nowikipre class="brush:xquery">html:parse("<a href='ok.html'/>", map { 'nons' := true() })</nowikipre></code> creates an XML document without namespaces. It returns ;Result:
<pre class="brush:xml">
<html>
</html>
</pre>
* ===Parsing binary input=== Binary input can be specified in order to let the HTML parser detect the correct encoding: ;Query:<code><nowikipre class="brush:xquery">html:parse(fetch:content-binary("http://en.wikipedia.org"))</nowikipre> ;Result:<pre class="brush:xml"><html xmlns="http://www.w3.org/code1999/xhtml" class="client-nojs" dir="ltr" lang="en"> returns an XML representation of <head> <title>Wikipedia, the English Wikipedia main pagefree encyclopedia</title> <meta charset="UTF-8"/> .. The input is passed on in its binary representation such that the HTML parser can automatically detect the correct encoding.|}</pre>
=Errors=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu