|
|||||||||
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.DocumentInstr
public class DocumentInstr
An instruction to create a document node. This corresponds to the xsl:document-node instruction in XSLT. It is also used to support the document node constructor expression in XQuery, and is generated implicitly within an xsl:variable that constructs a temporary tree.
Conceptually it represents an XSLT instruction xsl:document-node, with no attributes, whose content is a complex content constructor for the children of the document node.
Field Summary |
---|
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 | |
---|---|
DocumentInstr(boolean textOnly,
String constantText,
String baseURI)
Create a document constructor instruction |
Method Summary | |
---|---|
protected void |
checkContentSequence(StaticContext env)
Check statically that the sequence of child instructions doesn't violate any obvious constraints on the content of the node |
protected static void |
checkContentSequence(StaticContext env,
Expression content,
int validation,
SchemaType type)
|
Expression |
copy()
Copy an expression. |
Item |
evaluateItem(XPathContext context)
Evaluate as an expression. |
void |
explain(ExpressionPresenter out)
Diagnostic print of expression structure. |
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). |
int |
getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes (the string "document-constructor") |
ItemType |
getItemType(TypeHierarchy th)
Get the item type |
Expression |
getStringValueExpression(StaticContext env)
In the case of a text-only instruction (xsl:variable containing a text node or one or more xsl:value-of instructions), return an expression that evaluates to the textual content as an instance of xs:untypedAtomic |
boolean |
isTextOnly()
Determine whether this is a "text only" document: essentially, an XSLT xsl:variable that contains a single text node or xsl:value-of instruction. |
EventIterator |
iterateEvents(XPathContext context)
Deliver the result of the expression as a sequence of events. |
TailCall |
processLeavingTail(XPathContext context)
ProcessLeavingTail: called to do the real work of this instruction. |
void |
processLeft(Stack<XPathContext> contextStack,
Stack state)
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) |
Expression |
simplify(ExpressionVisitor visitor)
Simplify an expression. |
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, setValidationMode, typeCheck |
Methods inherited from class net.sf.saxon.expr.instruct.Instruction |
---|
assembleParams, assembleTunnelParams, computeSpecialProperties, dynamicError, evaluateAsString, getConstructType, getExpressionName, getInstructionName, 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 |
Constructor Detail |
---|
public DocumentInstr(boolean textOnly, String constantText, String baseURI)
textOnly
- true if the content contains text nodes onlyconstantText
- if the content contains text nodes only and the text is known at compile time,
supplies the textual contentbaseURI
- the base URI of the instructionMethod Detail |
---|
public int getImplementationMethod()
getImplementationMethod
in class Instruction
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public boolean isTextOnly()
public Expression simplify(ExpressionVisitor visitor) throws XPathException
simplify
in class ParentNodeConstructor
visitor
- an expression visitor
XPathException
- if an error is discovered during expression rewritingprotected void checkContentSequence(StaticContext env) throws XPathException
checkContentSequence
in class ParentNodeConstructor
env
- the static context
XPathException
protected static void checkContentSequence(StaticContext env, Expression content, int validation, SchemaType type) throws XPathException
XPathException
public Expression getStringValueExpression(StaticContext env)
env
- the static evaluation context
public Expression copy()
copy
in class Expression
public ItemType getItemType(TypeHierarchy th)
getItemType
in class Instruction
th
- The TypeHierarchy
public TailCall processLeavingTail(XPathContext context) throws XPathException
Instruction
processLeavingTail
in interface TailCallReturner
processLeavingTail
in class Instruction
context
- The dynamic context of the transformation, giving access to the current node,
the current variables, etc.
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
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
expressionpublic 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 evaluationpublic int getInstructionNameCode()
getInstructionNameCode
in class Instruction
public void explain(ExpressionPresenter out)
explain
in class Expression
out
- the expression presenter used to display the structure
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |