|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.expr.Expression net.sf.saxon.expr.instruct.Instruction net.sf.saxon.expr.instruct.ParentNodeConstructor net.sf.saxon.expr.instruct.ElementCreator
public abstract class ElementCreator
An instruction that creates an element node. There are two subtypes, FixedElement for use where the name is known statically, and Element where it is computed dynamically. To allow use in both XSLT and XQuery, the class acts both as an Instruction and as an Expression.
Field Summary | |
---|---|
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 boolean |
preservingTypes
Flag set to true if validation=preserve and no schema type supplied for validation |
Fields inherited from class net.sf.saxon.expr.instruct.ParentNodeConstructor |
---|
content |
Fields inherited from class net.sf.saxon.expr.Expression |
---|
EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, PUSH_SELECTION, staticProperties, WATCH_METHOD |
Constructor Summary | |
---|---|
ElementCreator()
Construct an ElementCreator. |
Method Summary | |
---|---|
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. |
int[] |
getActiveNamespaces()
Callback to get a list of the intrinsic namespaces that need to be generated for the element. |
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 int |
getNameCode(XPathContext context,
NodeInfo copiedNode)
Determine (at run-time) the name code of the element being constructed |
protected abstract String |
getNewBaseURI(XPathContext context,
NodeInfo copiedNode)
Get the base URI for the element being constructed |
boolean |
isInheritNamespaces()
Determine whether the inherit namespaces flag is set |
boolean |
isPreservingTypes()
Determine whether this elementCreator performs validation or strips type annotations |
EventIterator |
iterateEvents(XPathContext context)
Deliver the result of the expression as a sequence of events. |
protected EventIterator |
iterateEvents(XPathContext context,
NodeInfo copiedNode)
|
protected abstract void |
outputNamespaceNodes(XPathContext context,
Receiver receiver,
int 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. |
protected TailCall |
processLeavingTail(XPathContext context,
NodeInfo copiedNode)
Evaluate the instruction to produce a new element node. |
void |
processLeft(Stack<XPathContext> contextStack,
Stack state)
In streaming mode, process the first half of the instruction (to start a new document or element) |
protected void |
processLeft(Stack<XPathContext> contextStack,
Stack state,
NodeInfo copiedNode)
In streaming mode, process the first half of the instruction (to start a new document or element) |
void |
processRight(Stack<XPathContext> contextStack,
Stack state)
In streaming mode, proecss the right half of the instruction (to end a new document or element) |
void |
setValidationMode(int mode)
Set the validation mode for the new element |
void |
suppressValidation(int validationMode)
Suppress validation on contained element constructors, on the grounds that the parent element is already performing validation. |
Methods inherited from class net.sf.saxon.expr.instruct.ParentNodeConstructor |
---|
addToPathMap, computeCardinality, createsNewNodes, getBaseURI, getCardinality, getContentExpression, getSchemaType, getValidationMode, isLazyConstruction, isNamespaceSensitive, iterateSubExpressions, optimize, promoteInst, replaceSubExpression, setBaseURI, setContentExpression, setLazyConstruction, setSchemaType, simplify, typeCheck |
Methods inherited from class net.sf.saxon.expr.instruct.Instruction |
---|
assembleParams, assembleTunnelParams, dynamicError, evaluateAsString, getConstructType, getExpressionName, getInstructionName, getInstructionNameCode, getIteratorFromProcessMethod, getSourceLocator, isXSLT, iterate, process, promote |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.xml.transform.SourceLocator |
---|
getColumnNumber, getLineNumber, getPublicId, getSystemId |
Field Detail |
---|
protected boolean inheritNamespaces
protected boolean preservingTypes
Constructor Detail |
---|
public ElementCreator()
Method Detail |
---|
public ItemType getItemType(TypeHierarchy th)
getItemType
in class Instruction
th
- the type hierarchy cache
public boolean isPreservingTypes()
public boolean isInheritNamespaces()
public int computeSpecialProperties()
computeSpecialProperties
in class Instruction
public void setValidationMode(int mode)
setValidationMode
in class ParentNodeConstructor
mode
- the validation mode, for example Validation.STRICT
public void suppressValidation(int validationMode)
suppressValidation
in class Expression
validationMode
- the kind of validation being performed on the parent expressionprotected void checkContentSequence(StaticContext env) throws XPathException
checkContentSequence
in class ParentNodeConstructor
env
- the static context
XPathException
public abstract int getNameCode(XPathContext context, NodeInfo copiedNode) throws XPathException
context
- the XPath dynamic evaluation contextcopiedNode
-
XPathException
- if a failure occursprotected abstract String getNewBaseURI(XPathContext context, NodeInfo copiedNode)
context
- the XPath dynamic evaluation contextcopiedNode
- the node being copied (for xsl:copy), otherwise null
protected abstract void outputNamespaceNodes(XPathContext context, Receiver receiver, int 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 otherwise
XPathException
public int[] getActiveNamespaces() throws XPathException
XPathException
public 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 context
XPathException
- 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 context
XPathException
protected 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
XPathException
public void processLeft(Stack<XPathContext> contextStack, Stack state) throws XPathException
contextStack
- the dynamic evaluation contextstate
- a stack on which the instruction can save state information for use during the corresponding
XPathException
protected final void processLeft(Stack<XPathContext> contextStack, Stack state, NodeInfo copiedNode) throws XPathException
contextStack
- the dynamic evaluation contextstate
- a stack on which the instruction can save state information for use during the corresponding
XPathException
public void processRight(Stack<XPathContext> contextStack, Stack state) throws XPathException
contextStack
- state
- a stack on which the instruction can save state information for use during the corresponding
XPathException
public Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in interface EvaluableItem
evaluateItem
in class Instruction
context
- The context in which the expression is to be evaluated
XPathException
- if any dynamic error occurs evaluating the
expression
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |