Changes

Jump to navigation Jump to search
1,561 bytes added ,  23:49, 2 January 2013
Created page with "This XQuery Module provides functions for converting HTML to XML. =Conventions= All functions in this module are assigned to the {{Code|http://basex.org/modu..."
This [[Module Library|XQuery Module]] provides functions for converting HTML to XML.

=Conventions=

All functions in this module are assigned to the {{Code|http://basex.org/modules/html}} namespace, which is statically bound to the {{Code|html}} prefix.<br/>
All errors are assigned to the {{Code|http://basex.org/errors}} namespace, which is statically bound to the {{Code|bxerr}} prefix.

=Functions=

==html:parse==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|html:parse|$input as xs:anyAtomicType|document-node()}}<br />
|-
| '''Summary'''
|Converts the HTML document specified by {{Code|$input}} to XML, and returns a document node. The input may either be a string or a binary item (xs:hexBinary, xs:base64Binary). If the input is passed on in its binary representation, the HTML parser will try to automatically choose the correct encoding.
|-
| '''Errors'''
|{{Error|BXHL0001|#Errors}} the input cannot be converted to XML.
|-
| '''Examples'''
|
* {{Code|html:parse("<html></html>")}} returns {{Code|<html/>}}
* <code><nowiki>html:parse(fetch:content-binary("http://en.wikipedia.org"))</nowiki></code> returns an XML representation of the English Wikipedia main page. The input is passed on its binary representation such that the HTML parser can automatically detect the correct encoding.
|}

=Errors=

{| width='100%' class="wikitable" width="100%"
! width="5%"|Code
! width="95%"|Description
|-
|{{Code|BXHL0001}}
|The input cannot be converted to XML.
|}

=Changelog=

The module was introduced with Version 7.3.

[[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu