Top Description Inners Fields Constructors Methods
com.sun.org.apache.xalan.internal.xsltc.dom

public final Class SAXImpl

extends SAX2DTM2
implements DOMEnhancedForDTM, DOMBuilder
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.xalan.internal.xsltc.dom.DOMBuilder, com.sun.org.apache.xalan.internal.xsltc.dom.ExtendedSAX, org.xml.sax.ext.DeclHandler, org.xml.sax.DTDHandler, org.xml.sax.ext.LexicalHandler, org.xml.sax.ContentHandler, com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM, com.sun.org.apache.xalan.internal.xsltc.DOM
Imports
com.sun.org.apache.xalan.internal.xsltc.DOM, .DOMEnhancedForDTM, .StripFilter, .TransletException, com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary, com.sun.org.apache.xml.internal.dtm.Axis, .DTM, .DTMAxisIterator, .DTMManager, .DTMWSFilter, com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIterNodeList, .DTMDefaultBase, .DTMNodeProxy, .EmptyIterator, com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2, com.sun.org.apache.xml.internal.serializer.SerializationHandler, .ToXMLSAXHandler, com.sun.org.apache.xml.internal.utils.SystemIDResolver, .XMLStringFactory, java.util.HashMap, .Map, javax.xml.transform.Source, javax.xml.transform.dom.DOMSource, org.w3c.dom.Document, .DocumentType, .Entity, .NamedNodeMap, .Node, .NodeList, org.xml.sax.Attributes, .SAXException

SAXImpl is the core model for SAX input source. SAXImpl objects are usually created from an XSLTCDTMManager.

DOMSource inputs are handled using DOM2SAX + SAXImpl. SAXImpl has a few specific fields (e.g. _node2Ids, _document) to keep DOM-related information. They are used when the processing behavior between DOM and SAX has to be different. Examples of these include id function and unparsed entity.

SAXImpl extends SAX2DTM2 instead of SAX2DTM for better performance.

Authors
Jacek Ambroziak, Santiago Pericas-Geertsen, Morten Jorgensen, Douglas Sellers

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
SAXImpl.NamespaceAttributeIterator

Iterator that returns attributes within a given namespace for a node.

public class
SAXImpl.NamespaceChildrenIterator

Iterator that returns children within a given namespace for a given node.

public class
SAXImpl.NamespaceWildcardIterator

Iterator that handles node tests that test for a namespace, but have a wild card for the local name of the node, i.e., node tests of the form <axis>::<prefix>:*

private class
SAXImpl.NodeValueIterator

This is a specialised iterator for predicates comparing node or attribute values to variable or parameter values.

public class
SAXImpl.TypedNamespaceIterator

Iterator that returns the namespace nodes as defined by the XPath data model for a given node, filtered by extended type ID.

Field Summary

Modifier and TypeField and Description
private boolean
private Document
private static int
private BitArray
private XSLTCDTMManager
private boolean
private boolean
private int
private int
private Map<Node, Integer>
private NodeList[]
private Node[]
private Map<Integer, Integer>
private boolean
private int
private int
private int
private int[]
private static final DTMAxisIterator
private static final String
private static final String
private static final String
private static final String
private static final String
Inherited from com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2:
m_blocksizem_buildIdIndexm_extendedTypesm_MASKm_SHIFTm_valuesTEXT_LENGTH_BITSTEXT_LENGTH_MAXTEXT_OFFSET_BITSTEXT_OFFSET_MAX

Constructor Summary

AccessConstructor and Description
public
SAXImpl(XSLTCDTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, boolean buildIdIndex)

Construct a SAXImpl object using the default block size.

public
SAXImpl(XSLTCDTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, int blocksize, boolean buildIdIndex, boolean newNameTable)

Construct a SAXImpl object using the given block size.

Method Summary

Modifier and TypeMethod and Description
public void
characters(char[]
the characters from the XML document
ch
,
int
the start position in the array
start
,
int
the number of characters to read from the array
length
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.characters.

Implements org.xml.sax.ContentHandler.characters.

SAX2: Receive notification of character data.

public void
characters(final int node, SerializationHandler handler)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.characters.

Copy the string value of a node directly to an output handler

public void
comment(char[]
An array holding the characters in the comment.
ch
,
int
The starting position in the array.
start
,
int
The number of characters to use from the array.
length
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2.comment.

Implements org.xml.sax.ext.LexicalHandler.comment.

SAX2: Report an XML comment anywhere in the document.

public void
copy(DTMAxisIterator nodes, SerializationHandler handler)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.copy.

Copy a node-set to an output handler

public void
copy(SerializationHandler handler)

Copy the whole tree to an output handler

public void
copy(final int node, SerializationHandler handler)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.copy.

Performs a deep copy (ref.

private final void
copy(final int node, SerializationHandler handler, boolean isChild)

private void
copyPI(final int node, SerializationHandler handler)

Copies a processing instruction node to an output handler

private void
public void
endDocument()

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2.endDocument.

Implements org.xml.sax.ContentHandler.endDocument.

SAX2: Receive notification of the end of a document.

public void
endElement(String
the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
namespaceURI
,
String
the local name (without prefix), or the empty string if Namespace processing is not being performed
localName
,
String
the qualified XML name (with prefix), or the empty string if qualified names are not available
qname
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2.endElement.

Implements org.xml.sax.ContentHandler.endElement.

SAX2: Receive notification of the end of an element.

public int
getAttributeNode(final int type, final int element)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getAttributeNode.

Returns the attribute node of a given type (if any) for an element

public String
getAttributeValue(final int type, final int element)

Returns the value of a given attribute type of a given element

public String
getAttributeValue(final String name, final int element)

This method is for testing/debugging only

public DTMAxisIterator
getAxisIterator(final int
One of Axes.ANCESTORORSELF, etc.
axis
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBaseIterators.getAxisIterator.

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getAxisIterator, com.sun.org.apache.xml.internal.dtm.DTM.getAxisIterator.

This is a shortcut to the iterators that implement the supported XPath axes (only namespace::) is not supported.

public DOMBuilder
getBuilder()

Returns an instance of the DOMBuilder inner class This class will consume the input document through a SAX2 interface and populate the tree.

public DTMAxisIterator
getChildren(final int node)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getChildren.

Returns an iterator with all the children of a given node

public String
getDocumentURI()

Implements com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM.getDocumentURI.

Returns the origin of the document from which the tree was built

public String
public int

Returns:

The identity of the node whose id is the given String.
getElementById
(String
The id String
idString
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.getElementById.

Implements com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM.getElementById, com.sun.org.apache.xml.internal.dtm.DTM.getElementById.

Return the node identity for a given id String

public Map<String, Integer>

Returns:

the attributes map.
getElementsWithIDs
()

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getElementsWithIDs.

Return the attributes map.

public int
getGeneralizedType(final String name)

Returns the internal type associated with an expanded QName

public int
getGeneralizedType(final String name, boolean searchOnly)

Returns the internal type associated with an expanded QName

public DTMAxisIterator
getIterator()

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getIterator.

Returns singleton iterator containg the document root Works for them main document (mark == 0).

public String
getLanguage(int node)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getLanguage.

Returns a node' defined language for a node (if any)

public short[]
getMapping(String[] names, String[] uris, int[] types)

Implements com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM.getMapping.

Get mapping from DOM element/attribute types to external types

private short[]
getMapping2(String[] names, String[] uris, int[] types)

Get mapping from DOM element/attribute types to external types.

public DTMAxisIterator
getNamespaceAxisIterator(int axis, int ns)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getNamespaceAxisIterator.

Do not think that this returns an iterator for the namespace axis.

public short[]
getNamespaceMapping(String[] namespaces)

Implements com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM.getNamespaceMapping.

Get mapping from DOM namespace types to external namespace types

public String
getNamespaceName(final int node)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getNamespaceName.

Returns the namespace URI to which a node belongs

public int
getNamespaceType(final int
the id of the node.
node
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase.getNamespaceType.

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getNamespaceType.

Returns the namespace type of a specific node

public String
public DTMAxisIterator
public int
getNSType(int node)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getNSType.

Get mapping from DOM namespace types to external namespace types

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

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getNthDescendant.

Returns the nth descendant of a node

public SerializationHandler
getOutputDomBuilder()

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getOutputDomBuilder.

Return a SerializationHandler for output handling.

public DOM
getResultTreeFrag(int initSize, int rtfType)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getResultTreeFrag.

Return a instance of a DOM class to be used as an RTF

public DOM

Returns:

The DOM object which represents the RTF.
getResultTreeFrag
(int
The initial size of the DOM.
initSize
,
int
The type of the RTF
rtfType
,
boolean
true if the RTF should be registered with the DTMManager.
addToManager
)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getResultTreeFrag.

Return a instance of a DOM class to be used as an RTF

public int[]
getReverseMapping(String[] names, String[] uris, int[] types)

Implements com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM.getReverseMapping.

Get mapping from external element/attribute types to DOM types

public short[]
getReverseNamespaceMapping(String[] namespaces)

Implements com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM.getReverseNamespaceMapping.

Get mapping from external namespace types to DOM namespace types

protected boolean

Returns:

whether or not to strip whitespace nodes.
getShouldStripWhitespace
()

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase.getShouldStripWhitespace.

Find out whether or not to strip whitespace nodes.

public int
getSize()

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getSize.

Returns the number of nodes in the tree (used for indexing)

public DTMAxisIterator
getTypedAxisIterator(int
One of Axes.ANCESTORORSELF, etc.
axis
,
int
An extended type ID.
type
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBaseIterators.getTypedAxisIterator.

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getTypedAxisIterator, com.sun.org.apache.xml.internal.dtm.DTM.getTypedAxisIterator.

Similar to getAxisIterator, but this one returns an iterator containing nodes of a typed axis (ex.: child::foo)

public DTMAxisIterator
getTypedChildren(final int type)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getTypedChildren.

Returns an iterator with all children of a specific type for a given node (element)

public DTMAxisIterator
getTypedDescendantIterator(int type)

Returns an iterator with all descendants of a node that are of a given type.

public String
getUnparsedEntityURI(String
A string containing the Entity Name of the unparsed entity.
name
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.getUnparsedEntityURI.

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.getUnparsedEntityURI, com.sun.org.apache.xml.internal.dtm.DTM.getUnparsedEntityURI.

The getUnparsedEntityURI function returns the URI of the unparsed entity with the specified name in the same document as the context node (see [3.3 Unparsed Entities]).

private void
handleTextEscaping()

Creates a text-node and checks if it is a whitespace node.

public boolean
hasDOMSource()

Implements com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM.hasDOMSource.

Return true if the input source is DOMSource.

public void
ignorableWhitespace(char[]
the characters from the XML document
ch
,
int
the start position in the array
start
,
int
the number of characters to read from the array
length
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.ignorableWhitespace.

Implements org.xml.sax.ContentHandler.ignorableWhitespace.

SAX2: Receive notification of ignorable whitespace in element content.

public boolean
isAttribute(final int node)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.isAttribute.

Returns 'true' if a specific node is an attribute (of any type)

public boolean
isElement(final int node)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.isElement.

Returns 'true' if a specific node is an element (of any type)

public boolean
lessThan(int node1, int node2)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.lessThan.

Returns true if node1 comes before node2 in document order

public String
lookupNamespace(int node, String prefix)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.lookupNamespace.

Lookup a namespace URI from a prefix starting at node.

public Node
makeNode(int index)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.makeNode.

Create an org.w3c.dom.Node from a node in the tree

public Node
makeNode(DTMAxisIterator iter)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.makeNode.

Create an org.w3c.dom.Node from a node in an iterator The iterator most be started before this method is called

public NodeList
makeNodeList(int index)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.makeNodeList.

Create an org.w3c.dom.NodeList from a node in the tree

public NodeList
makeNodeList(DTMAxisIterator iter)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.makeNodeList.

Create an org.w3c.dom.NodeList from a node iterator The iterator most be started before this method is called

public void
migrateTo(DTMManager
the DTMManager
manager
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.migrateTo.

Implements com.sun.org.apache.xml.internal.dtm.DTM.migrateTo.

Migrate a DTM built with an old DTMManager to a new DTMManager.

public DTMAxisIterator
orderNodes(DTMAxisIterator source, int node)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.orderNodes.

Encapsulates an iterator in an OrderedIterator to ensure node order

public void
processingInstruction(String
the processing instruction target
target
,
String
the processing instruction data, or null if none was supplied. The data does not include any whitespace separating it from the target
data
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2.processingInstruction.

Implements org.xml.sax.ContentHandler.processingInstruction.

SAX2: Receive notification of a processing instruction.

public void
public void
setDocumentURI(String uri)

Implements com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM.setDocumentURI.

Define the origin of the document from which the tree was built

public boolean
setEscaping(boolean value)

public void
setFilter(StripFilter filter)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.setFilter.

Part of the DOM interface - no function here.

public void
setupMapping(String[] names, String[] urisArray, int[] typesArray, String[] namespaces)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.setupMapping.

public String
shallowCopy(final int node, SerializationHandler handler)

Implements com.sun.org.apache.xalan.internal.xsltc.DOM.shallowCopy.

Performs a shallow copy (ref.

public void
startDocument()

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2.startDocument.

Implements org.xml.sax.ContentHandler.startDocument.

SAX2: Receive notification of the beginning of a document.

public void
startElement(String uri, String localName, String qname, Attributes attributes, Node node)

Specialized interface used by DOM2SAX.

public void
startElement(String
the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
uri
,
String
the local name (without prefix), or the empty string if Namespace processing is not being performed
localName
,
String
the qualified name (with prefix), or the empty string if qualified names are not available
qname
,
Attributes
the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. The value of this object after startElement returns is undefined
attributes
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2.startElement.

Implements org.xml.sax.ContentHandler.startElement.

SAX2: Receive notification of the beginning of an element.

public void
startPrefixMapping(String
the Namespace prefix being declared. An empty string is used for the default element namespace, which has no prefix.
prefix
,
String
the Namespace URI the prefix is mapped to
uri
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.startPrefixMapping.

Implements org.xml.sax.ContentHandler.startPrefixMapping.

SAX2: Begin the scope of a prefix-URI Namespace mapping.

private void
xmlSpaceDefine(String val, final int node)

Call this when an xml:space attribute is encountered to define the whitespace strip/preserve settings.

private void
xmlSpaceRevert(final int node)

Call this from endElement() to revert strip/preserve setting to whatever it was before the corresponding startElement().

Inherited from com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2:
_exptype_exptype2_exptype2Type_firstch2_nextsib2_parent2_type2addNodecharactersFlushcopyAttributecopyAttributescopyElementcopyNScopyTextNodedispatchCharactersEventsgetExpandedTypeID2getFirstAttributegetFirstAttributeIdentitygetIdForNamespacegetLocalNamegetNextAttributeIdentitygetNextNamespaceNode2getNodeNameXgetNodeValuegetStringValuegetStringValuegetStringValueXgetTypedAttribute