public abstract class ElementCreator extends ParentNodeConstructor
Modifier and Type | Field and Description |
---|---|
protected boolean |
inheritNamespacesFromParent
The inheritNamespacesFromParent flag indicates that this element should inherit the namespaces of its
parent element in the result tree.
|
protected boolean |
inheritNamespacesToChildren
The inheritNamespacesToChildren flag indicates that the namespace nodes on the element created by this instruction
are to be inherited (copied) on the children of this element.
|
protected Expression |
onEmpty
The onEmpty expression is used in XSLT 3.0 to supply an alternative result to be returned
when the content of the element (including attributes) is empty.
|
content, preservingTypes
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD
Constructor and Description |
---|
ElementCreator()
Construct an ElementCreator.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkContentSequence(StaticContext env)
Check statically whether the content of the element creates attributes or namespaces
after creating any child nodes
|
int |
computeSpecialProperties()
Get the static properties of this expression (other than its type).
|
Item |
evaluateItem(XPathContext context)
Evaluate the constructor, returning the constructed element node.
|
NamespaceBinding[] |
getActiveNamespaces()
Callback to get a list of the intrinsic namespaces that need to be generated for the element.
|
int |
getCardinality()
Determine the static cardinality of the expression.
|
abstract NodeName |
getElementName(XPathContext context,
NodeInfo copiedNode)
Determine (at run-time) the name code of the element being constructed
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
ItemType |
getItemType()
Get the item type of the value returned by this instruction
|
abstract String |
getNewBaseURI(XPathContext context,
NodeInfo copiedNode)
Get the base URI for the element being constructed
|
Expression |
getOnEmpty()
Get the on-empty expression, which defines the value to be returned if the element would otherwise
be empty
|
StreamingAdjunct |
getStreamingAdjunct()
Get a class that supports streamed evaluation of this expression
|
boolean |
isInheritNamespacesFromParent()
Determine whether this element inherits namespaces from its parent.
|
boolean |
isInheritNamespacesToChildren()
Determine whether the inherit namespaces flag is set
|
EventIterator |
iterateEvents(XPathContext context)
Deliver the result of the expression as a sequence of events.
|
protected EventIterator |
iterateEvents(XPathContext context,
NodeInfo copiedNode) |
Iterable<Operand> |
operands()
Get the immediate sub-expressions of this expression, with information about the relationship
of each expression to its parent expression.
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.
|
abstract void |
outputNamespaceNodes(XPathContext context,
Receiver receiver,
NodeName nameCode,
NodeInfo copiedNode)
Callback to output namespace nodes for the new element.
|
TailCall |
processLeavingTail(XPathContext context)
Evaluate the instruction to produce a new element node.
|
TailCall |
processLeavingTail(XPathContext context,
NodeInfo copiedNode)
Evaluate the instruction to produce a new element node.
|
boolean |
replaceOperand(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression
|
void |
setOnEmpty(Expression onEmpty)
Set the on-empty expression, which defines the value to be returned if the element would otherwise
be empty
|
Expression |
simplify(ExpressionVisitor visitor)
Simplify an expression.
|
void |
suppressValidation(int parentValidationMode)
Suppress validation on contained element constructors, on the grounds that the parent element
is already performing validation.
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Perform type checking of an expression and its subexpressions.
|
addToPathMap, computeCardinality, createsNewNodes, getBaseURI, getContentExpression, getSchemaType, getValidationAction, getValidationOptions, isLazyConstruction, isPreservingTypes, promoteInst, setBaseURI, setContentExpression, setLazyConstruction, setNoNeedToStrip, setValidationAction
assembleParams, assembleTunnelParams, dynamicError, evaluateAsString, getConstructType, getExpressionName, getInstructionName, getInstructionNameCode, getIteratorFromProcessMethod, getSourceLocator, isXSLT, iterate, process, promote, toStreamingPattern
adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, clearStreamabilityData, computeDependencies, computeStaticProperties, copy, doPromotion, dynamicError, effectiveBooleanValue, evaluatePendingUpdates, explain, explain, getColumnNumber, getConfiguration, getContainer, getDependencies, getEvaluationMethod, getExpressionCompiler, getHostLanguage, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLocationId, getObjectName, getPosture, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getStreamability, getSweep, getSystemId, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isIdentical, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, makeStreamingAdjunct, markTailFunctionCalls, operandList, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, setPostureAndSweep, staticTypeCheck, toPattern, toShortString, toString, typeError, unordered
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getColumnNumber, getLineNumber, getPublicId, getSystemId
protected boolean inheritNamespacesToChildren
protected boolean inheritNamespacesFromParent
protected Expression onEmpty
public ElementCreator()
public Expression simplify(ExpressionVisitor visitor) throws XPathException
Expression
simplify
in class Expression
visitor
- an expression visitorXPathException
- if an error is discovered during expression
rewritingpublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Expression
This checks statically that the operands of the expression have the correct type; if necessary it generates code to do run-time type checking or type conversion. A static type error is reported only if execution cannot possibly succeed, that is, if a run-time type error is inevitable. The call may return a modified form of the expression.
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable. However, the types of such functions and variables may not be accurately known if they have not been explicitly declared.
If the implementation returns a value other than "this", then it is required to ensure that the location information in the returned expression have been set up correctly. It should not rely on the caller to do this, although for historical reasons many callers do so.
typeCheck
in class ParentNodeConstructor
visitor
- an expression visitorcontextInfo
- Information available statically about the context item: whether it is (possibly)
absent; its static type; its streaming posture.XPathException
- if an error is discovered during this phase
(typically a type error)public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
Expression
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
optimize
in class ParentNodeConstructor
visitor
- an expression visitorcontextItemType
- the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public ItemType getItemType()
getItemType
in class Instruction
public int getCardinality()
Expression
getCardinality
in class ParentNodeConstructor
public Iterable<Operand> operands()
ParentNodeConstructor
operands
in class ParentNodeConstructor
public boolean replaceOperand(Expression original, Expression replacement)
replaceOperand
in class ParentNodeConstructor
original
- the original subexpressionreplacement
- the replacement subexpressionpublic boolean isInheritNamespacesToChildren()
public boolean isInheritNamespacesFromParent()
public void setOnEmpty(Expression onEmpty)
onEmpty
- the expression to be evaluated if the element would otherwise be emptypublic Expression getOnEmpty()
public int computeSpecialProperties()
computeSpecialProperties
in class Instruction
public void suppressValidation(int parentValidationMode)
suppressValidation
in class Expression
parentValidationMode
- the kind of validation being performed on the parent expressionprotected void checkContentSequence(StaticContext env) throws XPathException
checkContentSequence
in class ParentNodeConstructor
env
- the static contextXPathException
public abstract NodeName getElementName(XPathContext context, NodeInfo copiedNode) throws XPathException
context
- the XPath dynamic evaluation contextcopiedNode
- for the benefit of xsl:copy, the node being copied; otherwise nullXPathException
- if a failure occurspublic abstract String getNewBaseURI(XPathContext context, NodeInfo copiedNode)
context
- the XPath dynamic evaluation contextcopiedNode
- the node being copied (for xsl:copy), otherwise nullpublic abstract void outputNamespaceNodes(XPathContext context, Receiver receiver, NodeName nameCode, NodeInfo copiedNode) throws XPathException
context
- The execution contextreceiver
- the Receiver where the namespace nodes are to be writtennameCode
- the name code of the element being createdcopiedNode
- the node being copied (for xsl:copy) or null otherwiseXPathException
- if a dynamic error occurspublic NamespaceBinding[] getActiveNamespaces() throws XPathException
XPathException
- if an error occurspublic int getImplementationMethod()
getImplementationMethod
in class Instruction
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public EventIterator iterateEvents(XPathContext context) throws XPathException
Expression
The events (of class PullEvent
) are either complete
items, or one of startElement, endElement, startDocument, or endDocument, known
as semi-nodes. The stream of events may also include a nested EventIterator.
If a start-end pair exists in the sequence, then the events between
this pair represent the content of the document or element. The content sequence will
have been processed to the extent that any attribute and namespace nodes in the
content sequence will have been merged into the startElement event. Namespace fixup
will have been performed: that is, unique prefixes will have been allocated to element
and attribute nodes, and all namespaces will be declared by means of a namespace node
in the startElement event or in an outer startElement forming part of the sequence.
However, duplicate namespaces may appear in the sequence.
The content of an element or document may include adjacent or zero-length text nodes, atomic values, and nodes represented as nodes rather than broken down into events.
iterateEvents
in class Expression
context
- The dynamic evaluation contextXPathException
- if a dynamic error occurs during expression evaluationprotected EventIterator iterateEvents(XPathContext context, NodeInfo copiedNode) throws XPathException
XPathException
public TailCall processLeavingTail(XPathContext context) throws XPathException
processLeavingTail
in interface TailCallReturner
processLeavingTail
in class Instruction
context
- XPath dynamic evaluation contextXPathException
public final TailCall processLeavingTail(XPathContext context, NodeInfo copiedNode) throws XPathException
context
- XPath dynamic evaluation contextcopiedNode
- null except in the case of xsl:copy, when it is the node being copied; otherwise nullXPathException
- if a dynamic error occurspublic Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in class Instruction
context
- The context in which the expression is to be evaluatedXPathException
- if any dynamic error occurs evaluating the
expressionpublic StreamingAdjunct getStreamingAdjunct()
getStreamingAdjunct
in class Expression
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.