Package org.rumbledb.expressions.xml
Class ComputedPIConstructorExpression
java.lang.Object
org.rumbledb.expressions.Node
org.rumbledb.expressions.Expression
org.rumbledb.expressions.xml.ComputedPIConstructorExpression
Expression representing a computed processing instruction constructor.
XQuery 3.1, 3.9.3.5: Computed Processing Instruction Constructors.
"A computed processing instruction constructor (CompPIConstructor) constructs a new processing instruction node with
its own node identity."
"If the keyword processing-instruction is followed by an NCName, that NCName is used as the target property of the
constructed node. If the keyword processing-instruction is followed by a name expression, the name expression is
processed as follows:"
Step 1: "Atomization is applied to the value of the name expression. If the result of atomization is not a single
atomic value of type xs:NCName, xs:string, or xs:untypedAtomic, a type error is raised [err:XPTY0004]."
Step 2: "If the atomized value of the name expression is of type xs:string or xs:untypedAtomic, that value is cast to
the type xs:NCName. If the value cannot be cast to xs:NCName, a dynamic error is raised [err:XQDY0041]."
Step 3: "The resulting NCName is then used as the target property of the newly constructed processing instruction
node. However, a dynamic error is raised if the NCName is equal to "XML" (in any combination of upper and lower case)
[err:XQDY0064]."
Content Step 1: "Atomization is applied to the value of the content expression, converting it to a sequence of atomic
values. (If the content expression is absent, the result of this step is an empty sequence.)"
Content Step 2: "If the result of atomization is an empty sequence, it is replaced by a zero-length string.
Otherwise, each atomic value in the atomized sequence is cast into a string. If any of the resulting strings contains
the string "?>", a dynamic error is raised [err:XQDY0026]."
Content Step 3: "The individual strings resulting from the previous step are merged into a single string by
concatenating them with a single space character between each pair. Leading whitespace is removed from the resulting
string. The resulting string then becomes the content property of the constructed processing instruction node."
-
Field Summary
Fields inherited from class org.rumbledb.expressions.Expression
expressionClassification, isSequential, staticContext, staticSequenceTypeFields inherited from class org.rumbledb.expressions.Node
highestExecutionMode, isInSequentialBlock -
Constructor Summary
ConstructorsConstructorDescriptionComputedPIConstructorExpression(String target, Expression contentExpression, ExceptionMetadata metadata) Constructor for static target: processing-instruction NCName { content }ComputedPIConstructorExpression(Expression nameExpression, Expression contentExpression, ExceptionMetadata metadata) Constructor for dynamic target: processing-instruction { nameExpression } { content } -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(AbstractNodeVisitor<T> visitor, T argument) Accept method for the visitor pattern.Returns all children nodes as a list.booleanvoidserializeToJSONiq(StringBuilder sb, int indent) Methods inherited from class org.rumbledb.expressions.Expression
alwaysReturnsAtMostOneItem, getStaticContextForRuntime, isUnset, isUpdating, isUpdatingNonSequential, print, setIsInSequentialBlock, setSequentialMethods inherited from class org.rumbledb.expressions.Node
getDescendants, getDescendantsMatching, getHighestExecutionMode, indentIt, isContextDependent, numberOfUnsetExecutionModes, toString
-
Constructor Details
-
ComputedPIConstructorExpression
public ComputedPIConstructorExpression(String target, Expression contentExpression, ExceptionMetadata metadata) Constructor for static target: processing-instruction NCName { content }- Parameters:
target- The static processing instruction targetcontentExpression- The content expressionmetadata- The exception metadata
-
ComputedPIConstructorExpression
public ComputedPIConstructorExpression(Expression nameExpression, Expression contentExpression, ExceptionMetadata metadata) Constructor for dynamic target: processing-instruction { nameExpression } { content }- Parameters:
nameExpression- The dynamic name expressioncontentExpression- The content expressionmetadata- The exception metadata
-
-
Method Details
-
hasStaticTarget
public boolean hasStaticTarget() -
accept
Description copied from class:NodeAccept method for the visitor pattern. -
getChildren
Description copied from class:NodeReturns all children nodes as a list. The list is new and can be modified at will by the caller.- Specified by:
getChildrenin classNode- Returns:
- the children nodes as a list.
-
serializeToJSONiq
- Specified by:
serializeToJSONiqin classNode
-