Class ComputedPIConstructorExpression

java.lang.Object
org.rumbledb.expressions.Node
org.rumbledb.expressions.Expression
org.rumbledb.expressions.xml.ComputedPIConstructorExpression

public class ComputedPIConstructorExpression extends Expression
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."
See Also:
  • 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 target
      contentExpression - The content expression
      metadata - 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 expression
      contentExpression - The content expression
      metadata - The exception metadata
  • Method Details

    • hasStaticTarget

      public boolean hasStaticTarget()
    • getTarget

      public String getTarget()
    • getNameExpression

      public Expression getNameExpression()
    • getContentExpression

      public Expression getContentExpression()
    • accept

      public <T> T accept(AbstractNodeVisitor<T> visitor, T argument)
      Description copied from class: Node
      Accept method for the visitor pattern.
      Specified by:
      accept in class Node
      Type Parameters:
      T - the type of the objects returned by the visitor.
      Parameters:
      visitor - the visitor.
      argument - the input from the visitor.
      Returns:
      the object returned by this visitor
    • getChildren

      public List<Node> getChildren()
      Description copied from class: Node
      Returns all children nodes as a list. The list is new and can be modified at will by the caller.
      Specified by:
      getChildren in class Node
      Returns:
      the children nodes as a list.
    • serializeToJSONiq

      public void serializeToJSONiq(StringBuffer sb, int indent)
      Specified by:
      serializeToJSONiq in class Node