org.apache.xalan.xsltc.dom

Class SimpleResultTreeImpl

public class SimpleResultTreeImpl extends EmptySerializer implements DOM, DTM

This class represents a light-weight DOM model for simple result tree fragment(RTF). A simple RTF is an RTF that has only one Text node. The Text node can be produced by a combination of Text, xsl:value-of and xsl:number instructions. It can also be produced by a control structure (xsl:if or xsl:choose) whose body is pure Text.

A SimpleResultTreeImpl has only two nodes, i.e. the ROOT node and its Text child. All DOM interfaces are overridden with this in mind. For example, the getStringValue() interface returns the value of the Text node. This class receives the character data from the characters() interface.

This class implements DOM and SerializationHandler. It also implements the DTM interface for support in MultiDOM. The nested iterators (SimpleIterator and SingletonIterator) are used to support the nodeset() extension function.

Nested Class Summary
classSimpleResultTreeImpl.SimpleIterator
The SimpleIterator is designed to support the nodeset() extension function.
classSimpleResultTreeImpl.SingletonIterator
The SingletonIterator is used for the self axis.
Field Summary
static intNUMBER_OF_NODES
static intRTF_ROOT
static intRTF_TEXT
Constructor Summary
SimpleResultTreeImpl(XSLTCDTMManager dtmManager, int documentID)
Method Summary
voidappendChild(int newChild, boolean clone, boolean cloneDepth)
voidappendTextChild(String str)
voidcharacters(int node, SerializationHandler handler)
Dispatch the character content of a node to an output handler.
voidcharacters(String str)
voidcharacters(char[] ch, int offset, int length)
voidcopy(int node, SerializationHandler handler)
voidcopy(DTMAxisIterator nodes, SerializationHandler handler)
voiddispatchCharactersEvents(int nodeHandle, ContentHandler ch, boolean normalize)
voiddispatchToEvents(int nodeHandle, ContentHandler ch)
voiddocumentRegistration()
voiddocumentRelease()
voidendDocument()
intgetAttributeNode(int gType, int element)
intgetAttributeNode(int elementHandle, String namespaceURI, String name)
DTMAxisIteratorgetAxisIterator(int axis)
DTMAxisTraversergetAxisTraverser(int axis)
DTMAxisIteratorgetChildren(int node)
ContentHandlergetContentHandler()
DeclHandlergetDeclHandler()
intgetDocument()
booleangetDocumentAllDeclarationsProcessed()
StringgetDocumentBaseURI()
StringgetDocumentEncoding(int nodeHandle)
intgetDocumentRoot(int nodeHandle)
StringgetDocumentStandalone(int nodeHandle)
StringgetDocumentSystemIdentifier(int nodeHandle)
StringgetDocumentTypeDeclarationPublicIdentifier()
StringgetDocumentTypeDeclarationSystemIdentifier()
StringgetDocumentURI(int node)
StringgetDocumentVersion(int documentHandle)
DTDHandlergetDTDHandler()
DTMManagerDefaultgetDTMManager()
intgetElementById(String elementId)
HashtablegetElementsWithIDs()
EntityResolvergetEntityResolver()
ErrorHandlergetErrorHandler()
intgetExpandedTypeID(int nodeHandle)
intgetExpandedTypeID(String namespace, String localName, int type)
intgetFirstAttribute(int nodeHandle)
intgetFirstChild(int nodeHandle)
intgetFirstNamespaceNode(int nodeHandle, boolean inScope)
DTMAxisIteratorgetIterator()
StringgetLanguage(int node)
intgetLastChild(int nodeHandle)
shortgetLevel(int nodeHandle)
LexicalHandlergetLexicalHandler()
StringgetLocalName(int nodeHandle)
StringgetLocalNameFromExpandedNameID(int ExpandedNameID)
DTMAxisIteratorgetNamespaceAxisIterator(int axis, int ns)
StringgetNamespaceFromExpandedNameID(int ExpandedNameID)
StringgetNamespaceName(int node)
intgetNamespaceType(int node)
StringgetNamespaceURI(int nodeHandle)
intgetNextAttribute(int nodeHandle)
intgetNextNamespaceNode(int baseHandle, int namespaceHandle, boolean inScope)
intgetNextSibling(int nodeHandle)
NodegetNode(int nodeHandle)
intgetNodeHandle(int nodeId)
Return the node handle from a node identity.
intgetNodeIdent(int nodehandle)
Return the node identity from a node handle.
StringgetNodeName(int node)
StringgetNodeNameX(int node)
shortgetNodeType(int nodeHandle)
StringgetNodeValue(int nodeHandle)
DTMAxisIteratorgetNodeValueIterator(DTMAxisIterator iter, int returnType, String value, boolean op)
intgetNSType(int node)
DTMAxisIteratorgetNthDescendant(int node, int n, boolean includeself)
SerializationHandlergetOutputDomBuilder()
intgetOwnerDocument(int nodeHandle)
intgetParent(int nodeHandle)
StringgetPrefix(int nodeHandle)
intgetPreviousSibling(int nodeHandle)
DOMgetResultTreeFrag(int initialSize, int rtfType)
DOMgetResultTreeFrag(int initialSize, int rtfType, boolean addToManager)
intgetSize()
SourceLocatorgetSourceLocatorFor(int node)
StringgetStringValue()
XMLStringgetStringValue(int nodeHandle)
char[]getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen)
intgetStringValueChunkCount(int nodeHandle)
StringgetStringValueX(int nodeHandle)
DTMAxisIteratorgetTypedAxisIterator(int axis, int type)
DTMAxisIteratorgetTypedChildren(int type)
StringgetUnparsedEntityURI(String name)
booleanhasChildNodes(int nodeHandle)
booleanisAttribute(int node)
booleanisAttributeSpecified(int attributeHandle)
booleanisCharacterElementContentWhitespace(int nodeHandle)
booleanisDocumentAllDeclarationsProcessed(int documentHandle)
booleanisElement(int node)
booleanisNodeAfter(int firstNodeHandle, int secondNodeHandle)
booleanisSupported(String feature, String version)
booleanlessThan(int node1, int node2)
StringlookupNamespace(int node, String prefix)
NodemakeNode(int index)
NodemakeNode(DTMAxisIterator iter)
NodeListmakeNodeList(int index)
NodeListmakeNodeList(DTMAxisIterator iter)
voidmigrateTo(DTMManager manager)
booleanneedsTwoThreads()
DTMAxisIteratororderNodes(DTMAxisIterator source, int node)
voidsetDocumentBaseURI(String baseURI)
booleansetEscaping(boolean escape)
voidsetFeature(String featureId, boolean state)
The DTM interfaces are not used in this class.
voidsetFilter(StripFilter filter)
voidsetProperty(String property, Object value)
voidsetupMapping(String[] names, String[] uris, int[] types, String[] namespaces)
StringshallowCopy(int node, SerializationHandler handler)
voidstartDocument()
We only need to override the endDocument, characters, and setEscaping interfaces.
booleansupportsPreStripping()

Field Detail

NUMBER_OF_NODES

public static final int NUMBER_OF_NODES

RTF_ROOT

public static final int RTF_ROOT

RTF_TEXT

public static final int RTF_TEXT

Constructor Detail

SimpleResultTreeImpl

public SimpleResultTreeImpl(XSLTCDTMManager dtmManager, int documentID)

Method Detail

appendChild

public void appendChild(int newChild, boolean clone, boolean cloneDepth)

appendTextChild

public void appendTextChild(String str)

characters

public void characters(int node, SerializationHandler handler)
Dispatch the character content of a node to an output handler. The escape setting should be taken care of when outputting to a handler.

characters

public void characters(String str)

characters

public void characters(char[] ch, int offset, int length)

copy

public void copy(int node, SerializationHandler handler)

copy

public void copy(DTMAxisIterator nodes, SerializationHandler handler)

dispatchCharactersEvents

public void dispatchCharactersEvents(int nodeHandle, ContentHandler ch, boolean normalize)

dispatchToEvents

public void dispatchToEvents(int nodeHandle, ContentHandler ch)

documentRegistration

public void documentRegistration()

documentRelease

public void documentRelease()

endDocument

public void endDocument()

getAttributeNode

public int getAttributeNode(int gType, int element)

getAttributeNode

public int getAttributeNode(int elementHandle, String namespaceURI, String name)

getAxisIterator

public DTMAxisIterator getAxisIterator(int axis)

getAxisTraverser

public DTMAxisTraverser getAxisTraverser(int axis)

getChildren

public DTMAxisIterator getChildren(int node)

getContentHandler

public ContentHandler getContentHandler()

getDeclHandler

public DeclHandler getDeclHandler()

getDocument

public int getDocument()

getDocumentAllDeclarationsProcessed

public boolean getDocumentAllDeclarationsProcessed()

getDocumentBaseURI

public String getDocumentBaseURI()

getDocumentEncoding

public String getDocumentEncoding(int nodeHandle)

getDocumentRoot

public int getDocumentRoot(int nodeHandle)

getDocumentStandalone

public String getDocumentStandalone(int nodeHandle)

getDocumentSystemIdentifier

public String getDocumentSystemIdentifier(int nodeHandle)

getDocumentTypeDeclarationPublicIdentifier

public String getDocumentTypeDeclarationPublicIdentifier()

getDocumentTypeDeclarationSystemIdentifier

public String getDocumentTypeDeclarationSystemIdentifier()

getDocumentURI

public String getDocumentURI(int node)

getDocumentVersion

public String getDocumentVersion(int documentHandle)

getDTDHandler

public DTDHandler getDTDHandler()

getDTMManager

public DTMManagerDefault getDTMManager()

getElementById

public int getElementById(String elementId)

getElementsWithIDs

public Hashtable getElementsWithIDs()

getEntityResolver

public EntityResolver getEntityResolver()

getErrorHandler

public ErrorHandler getErrorHandler()

getExpandedTypeID

public int getExpandedTypeID(int nodeHandle)

getExpandedTypeID

public int getExpandedTypeID(String namespace, String localName, int type)

getFirstAttribute

public int getFirstAttribute(int nodeHandle)

getFirstChild

public int getFirstChild(int nodeHandle)

getFirstNamespaceNode

public int getFirstNamespaceNode(int nodeHandle, boolean inScope)

getIterator

public DTMAxisIterator getIterator()

getLanguage

public String getLanguage(int node)

getLastChild

public int getLastChild(int nodeHandle)

getLevel

public short getLevel(int nodeHandle)

getLexicalHandler

public LexicalHandler getLexicalHandler()

getLocalName

public String getLocalName(int nodeHandle)

getLocalNameFromExpandedNameID

public String getLocalNameFromExpandedNameID(int ExpandedNameID)

getNamespaceAxisIterator

public DTMAxisIterator getNamespaceAxisIterator(int axis, int ns)

getNamespaceFromExpandedNameID

public String getNamespaceFromExpandedNameID(int ExpandedNameID)

getNamespaceName

public String getNamespaceName(int node)

getNamespaceType

public int getNamespaceType(int node)

getNamespaceURI

public String getNamespaceURI(int nodeHandle)

getNextAttribute

public int getNextAttribute(int nodeHandle)

getNextNamespaceNode

public int getNextNamespaceNode(int baseHandle, int namespaceHandle, boolean inScope)

getNextSibling

public int getNextSibling(int nodeHandle)

getNode

public Node getNode(int nodeHandle)

getNodeHandle

public int getNodeHandle(int nodeId)
Return the node handle from a node identity.

getNodeIdent

public int getNodeIdent(int nodehandle)
Return the node identity from a node handle.

getNodeName

public String getNodeName(int node)

getNodeNameX

public String getNodeNameX(int node)

getNodeType

public short getNodeType(int nodeHandle)

getNodeValue

public String getNodeValue(int nodeHandle)

getNodeValueIterator

public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType, String value, boolean op)

getNSType

public int getNSType(int node)

getNthDescendant

public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself)

getOutputDomBuilder

public SerializationHandler getOutputDomBuilder()

getOwnerDocument

public int getOwnerDocument(int nodeHandle)

getParent

public int getParent(int nodeHandle)

getPrefix

public String getPrefix(int nodeHandle)

getPreviousSibling

public int getPreviousSibling(int nodeHandle)

getResultTreeFrag

public DOM getResultTreeFrag(int initialSize, int rtfType)

getResultTreeFrag

public DOM getResultTreeFrag(int initialSize, int rtfType, boolean addToManager)

getSize

public int getSize()

getSourceLocatorFor

public SourceLocator getSourceLocatorFor(int node)

getStringValue

public String getStringValue()

getStringValue

public XMLString getStringValue(int nodeHandle)

getStringValueChunk

public char[] getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen)

getStringValueChunkCount

public int getStringValueChunkCount(int nodeHandle)

getStringValueX

public String getStringValueX(int nodeHandle)

getTypedAxisIterator

public DTMAxisIterator getTypedAxisIterator(int axis, int type)

getTypedChildren

public DTMAxisIterator getTypedChildren(int type)

getUnparsedEntityURI

public String getUnparsedEntityURI(String name)

hasChildNodes

public boolean hasChildNodes(int nodeHandle)

isAttribute

public boolean isAttribute(int node)

isAttributeSpecified

public boolean isAttributeSpecified(int attributeHandle)

isCharacterElementContentWhitespace

public boolean isCharacterElementContentWhitespace(int nodeHandle)

isDocumentAllDeclarationsProcessed

public boolean isDocumentAllDeclarationsProcessed(int documentHandle)

isElement

public boolean isElement(int node)

isNodeAfter

public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle)

isSupported

public boolean isSupported(String feature, String version)

lessThan

public boolean lessThan(int node1, int node2)

lookupNamespace

public String lookupNamespace(int node, String prefix)

makeNode

public Node makeNode(int index)

makeNode

public Node makeNode(DTMAxisIterator iter)

makeNodeList

public NodeList makeNodeList(int index)

makeNodeList

public NodeList makeNodeList(DTMAxisIterator iter)

migrateTo

public void migrateTo(DTMManager manager)

needsTwoThreads

public boolean needsTwoThreads()

orderNodes

public DTMAxisIterator orderNodes(DTMAxisIterator source, int node)

setDocumentBaseURI

public void setDocumentBaseURI(String baseURI)

setEscaping

public boolean setEscaping(boolean escape)

setFeature

public void setFeature(String featureId, boolean state)
The DTM interfaces are not used in this class. Implementing the DTM interface is a requirement from MultiDOM. If we have a better way of handling multiple documents, we can get rid of the DTM dependency. The following interfaces are just placeholders. The implementation does not have an impact because they will not be used.

setFilter

public void setFilter(StripFilter filter)

setProperty

public void setProperty(String property, Object value)

setupMapping

public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces)

shallowCopy

public String shallowCopy(int node, SerializationHandler handler)

startDocument

public void startDocument()
We only need to override the endDocument, characters, and setEscaping interfaces. A simple RTF does not have element nodes. We do not need to touch startElement and endElement.

supportsPreStripping

public boolean supportsPreStripping()
Copyright B) 2006 Apache XML Project. All Rights Reserved.