Changes

Jump to navigation Jump to search
95 bytes removed ,  17:39, 1 December 2023
m
Text replacement - "syntaxhighlight" to "pre"
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''
|<pre>html:doc(
$uri href as xs:string?, $options as map(*)? := ()map { }
) as document-node()?</pre>
|- valign="top"
| '''Summary'''
|Fetches the HTML document referred to by the given {{Code|$urihref}}, converts it to XML and returns a document node. The {{Code|$options}} argument can be used to set [[Parsers#Options|TagSoup Options]].
|- valign="top"
| '''Errors'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''
|<pre>html:parse(
$input value as xs:anyAtomicType, $options as map(*)? := ()map { }
) as document-node()</pre>
|- valign="top"
| '''Summary'''
|Converts the HTML document specified by {{Code|$inputvalue}} to XML and returns a document node:<br/>
* The input may be of type {{Code|xs:string}}, {{Code|xs:base64Binary}}, or {{Code|xs:hexBinary}}.
* If the input is passed on in its binary representation, and if no encoding option is supplied, the HTML parser will try to choose the correct encoding automatically.
The {{Code|$options}} argument can be used to set [[Parsers#Options|TagSoup Options]].
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''
|{{Code|'''html:parser'''() as xs:string}}<br/>
|- valign="top"
;Query:
<syntaxhighlight pre lang="'xquery"'>
html:parse("<html>")
</syntaxhighlightpre>
;Result:
<syntaxhighlight pre lang="xml">
<html xmlns="http://www.w3.org/1999/xhtml"/>
</syntaxhighlightpre>
===Specifying Options===
;Query:
<syntaxhighlight pre lang="'xquery"'>
html:parse("<a href='ok.html'/>", map { 'nons': false() })
</syntaxhighlightpre>
;Result:
<syntaxhighlight pre lang="xml">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
</body>
</html>
</syntaxhighlightpre>
===Parsing Binary Input===
;Query:
<syntaxhighlight pre lang="'xquery"'>
html:parse(fetch:binary("https://en.wikipedia.org"))
</syntaxhighlightpre>
;Result:
<syntaxhighlight pre lang="xml">
<html xmlns="http://www.w3.org/1999/xhtml" class="client-nojs" dir="ltr" lang="en">
<head>
<meta charset="UTF-8"/>
...
</syntaxhighlightpre>
=Errors=
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu