expkg-zone58:text.parse   library module

Summary
This module is designed to specify a small library of functions for parsing expressions in a number of languages into XML trees, and in the reverse direction serialising these trees into equivalent string expressions. Parsers are available for versions for XPath and XQuery.
Tags
See also: https://lists.w3.org/Archives/Public/public-expath/2015Feb/att-0003/xparse.html

Variables

$xp:default-opts

Summary
default options for parse function.
Type
map(*)

$xp:parsers

Summary
XML descriptions of the available parsers.
Type
element(xp:parser)*

Functions

xp:flatten

Summary
simplify by omitting elements with only one child
Signature
xp:flatten( input  as  element() ) as  element()
Parameters
  • input as element()
Return
  • element()

xp:get-parser

Summary
Select parser function for opts
Signature
xp:get-parser( opts  as  map(*) ) as  function(*)
Parameters
  • opts as map(*)
Return
  • function(*): parser function as function($xq as xs:string)

xp:parse

Summary
The xp:parse function returns a parse tree for an expression.
Signature
xp:parse( exp  as  xs:string ) as  element()
xp:parse( exp  as  xs:string, options  as  map(*) ) as  element()
Parameters
  • exp as xs:string
Return
  • element(): parse tree

xp:to-expression

Summary
The xp:to-expression function returns an expression tree corresponding to a given parse tree.
Signature
xp:to-expression( in  as  element() ) as  xs:string
xp:to-expression( in  as  element(), options  as  map(*) ) as  xs:string
Parameters
  • in as element()
Return
  • xs:string

xp:version

Summary
Get the parser function to be used for the supplied options
Signature
xp:version( opts  as  map(*) ) as  map(*)
Parameters
  • opts as map(*)
Return
  • map(*): parser function

Namespaces

The following namespaces are defined:

Prefix Uri
ann http://www.w3.org/2012/xquery
xp expkg-zone58:text.parse

Original Source Code

Not available