Changes

Jump to navigation Jump to search
256 bytes removed ,  13:07, 4 July 2023
In BaseX, two internal representations exist for nodes.
* XML fragments are generated by XQuery node constructors(<code><a/></code>, <code>element a {}</code>, etc.).db:b
* Database nodes are:
** stored in a persistent database on disk;
** nodes of a document that has been generated temporarily with {{Code|fn:doc}}, {{Code|fn:parse-xml}} and other functions; or
** the result of a [[XQuery Update#Main-Memory Updates|main-memory update operation]].
Some operations are restricted to database nodes, but you can convert XML fragments to database nodes by applying an empty [[XQuery_Update#update|update]] or [[XQuery_Update#transform|transform]] operation to a node. Two examples: * Retrieve the internal node id of an XML fragment:
<syntaxhighlight lang="xquery">
let $xml := <xml>hello world</xml> update {}
return db:node-id($xml/text())
</syntaxhighlight>
 
* Puts a marker element around the result of a full-text request (see {{Function|Full-Text|ft:mark}} for more details):
 
<syntaxhighlight lang="xquery">
copy $p := <xml>hello world</xml>
modify ()
return ft:mark($p[text() contains text 'word'], 'b')
</syntaxhighlight>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu