fn.nilled( arg as Node? ) as Boolean?
Summary: Returns an xs:boolean indicating whether the argument node is "nilled". If the argument is not an element node, returns the empty sequence. If the argument is the empty sequence, returns the empty sequence. For element nodes, true() is returned if the element is nilled, otherwise false().
Elements may be defined in a schema as nillable, which allows an empty instance of an element to a appear in a document even though its type requires that it always have some content. Nilled elements should always be empty but an element is not considered nilled just because it's empty. It must also have the type annotation attribute xsi:nil="true".
Parameters | |
---|---|
arg | The node to test for nilled status. |
fn.nilled(fn.head(xdmp.unquote('<foo/>')).xpath("/foo")); => false var node = fn.head(xdmp.unquote( '<foo xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>') ).xpath("/foo") fn.nilled(node); => true, if the schema for foo allows nillable var node = fn.head(xdmp.unquote( '<foo xsi:nil="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>') ).xpath("/foo") fn.nilled(node); => false fn.nilled(null) => () var node = new NodeBuilder(); node.addText("text node"); node.toNode(); fn.nilled(node); => ()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.