public abstract class ElementCreator extends ParentNodeConstructor
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
inheritNamespaces
The inheritNamespaces 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, preservingTypesEFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, INHERITED_CONTEXT, INSPECTION_CONTEXT, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, NAVIGATION_CONTEXT, NODE_VALUE_CONTEXT, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, W3C_CONSUMING, W3C_FREE_RANGING, W3C_GROUP_CONSUMING, W3C_MOTIONLESS, 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(TypeHierarchy th)
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 |
isInheritNamespaces()
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) |
Iterator<SubExpressionInfo> |
iterateSubExpressionInfo()
Get the immediate sub-expressions of this expression, with information about the relationship
of each expression to its parent expression.
|
Iterator<Expression> |
iterateSubExpressions()
Get the immediate sub-expressions of this expression.
|
Expression |
optimize(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType 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.
|
void |
processLeft(Stack<XPathContext> contextStack,
Stack<Object> state)
In streaming mode, process the first half of the instruction (to start a new document or element)
|
void |
processRight(Stack<XPathContext> contextStack,
Stack<Object> state)
In streaming mode, process the right half of the instruction (to end a new document or element)
|
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,
ExpressionVisitor.ContextItemType contextItemType)
Perform type checking of an expression and its subexpressions.
|
addToPathMap, computeCardinality, createsNewNodes, getBaseURI, getContentExpression, getSchemaType, getValidationAction, getValidationOptions, isLazyConstruction, isPreservingTypes, promoteInst, replaceSubExpression, setBaseURI, setContentExpression, setLazyConstruction, setNoNeedToStrip, setValidationActionassembleParams, assembleTunnelParams, dynamicError, evaluateAsString, getConstructType, getExpressionName, getInstructionName, getInstructionNameCode, getIteratorFromProcessMethod, getSourceLocator, isXSLT, iterate, process, promoteadoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, copy, doPromotion, dynamicError, effectiveBooleanValue, evaluatePendingUpdates, explain, explain, getColumnNumber, getColumnNumber, getContainer, getDependencies, getEvaluationMethod, getExecutable, getExpressionCompiler, getHostLanguage, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getStreamability, getSystemId, getSystemId, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, staticTypeCheck, toPattern, toStreamingPattern, toString, typeErrorclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetColumnNumber, getLineNumber, getPublicId, getSystemIdprotected boolean inheritNamespaces
protected Expression onEmpty
public ElementCreator()
public Expression simplify(ExpressionVisitor visitor) throws XPathException
ParentNodeConstructorsimplify in class ParentNodeConstructorvisitor - an expression visitorXPathException - if an error is discovered during expression
rewritingpublic Expression typeCheck(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
ExpressionThis 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 ParentNodeConstructorvisitor - 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_TYPEXPathException - if an error is discovered during this phase
(typically a type error)public Expression optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
ExpressionThis 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 ParentNodeConstructorvisitor - 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_TYPEXPathException - if an error is discovered during this phase
(typically a type error)public ItemType getItemType(TypeHierarchy th)
getItemType in class Instructionth - the type hierarchy cachepublic int getCardinality()
ExpressiongetCardinality in class ParentNodeConstructorpublic Iterator<Expression> iterateSubExpressions()
ParentNodeConstructoriterateSubExpressions in class ParentNodeConstructorpublic Iterator<SubExpressionInfo> iterateSubExpressionInfo()
ParentNodeConstructoriterateSubExpressionInfo in class ParentNodeConstructorpublic boolean isInheritNamespaces()
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 Instructionpublic void suppressValidation(int parentValidationMode)
suppressValidation in class ExpressionparentValidationMode - the kind of validation being performed on the parent expressionprotected void checkContentSequence(StaticContext env) throws XPathException
checkContentSequence in class ParentNodeConstructorenv - the static contextXPathExceptionpublic 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 InstructionExpression.ITERATE_METHOD or Expression.EVALUATE_METHOD or
Expression.PROCESS_METHODpublic EventIterator iterateEvents(XPathContext context) throws XPathException
ExpressionThe 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 Expressioncontext - The dynamic evaluation contextXPathException - if a dynamic error occurs during expression evaluationprotected EventIterator iterateEvents(XPathContext context, NodeInfo copiedNode) throws XPathException
XPathExceptionpublic TailCall processLeavingTail(XPathContext context) throws XPathException
processLeavingTail in interface TailCallReturnerprocessLeavingTail in class Instructioncontext - XPath dynamic evaluation contextXPathExceptionpublic 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 Instructioncontext - The context in which the expression is to be evaluatedXPathException - if any dynamic error occurs evaluating the
expressionpublic StreamingAdjunct getStreamingAdjunct()
getStreamingAdjunct in class Expressionpublic void processLeft(Stack<XPathContext> contextStack, Stack<Object> state) throws XPathException
contextStack - the dynamic evaluation contextstate - a stack on which the instruction can save state information for use during the correspondingXPathException - if a dynamic error occurspublic void processRight(Stack<XPathContext> contextStack, Stack<Object> state) throws XPathException
contextStack - the stack of XPath context objects for the current execution statestate - a stack on which the instruction can save state information for use during the correspondingXPathException - if a dynamic error occursCopyright (c) 2004-2013 Saxonica Limited. All rights reserved.