|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.dtm.ref.DTMDefaultBase org.apache.xml.dtm.ref.DTMDefaultBaseTraversers org.apache.xml.dtm.ref.DTMDefaultBaseIterators org.apache.xml.dtm.ref.sax2dtm.SAX2DTM
This class implements a DTM that tends to be optimized more for speed than for compactness, that is constructed via SAX2 ContentHandler events.
Nested Class Summary |
Nested classes inherited from class org.apache.xml.dtm.ref.DTMDefaultBaseIterators |
|
Nested classes inherited from class org.apache.xml.dtm.ref.DTMDefaultBaseTraversers |
|
Field Summary | |
private static boolean |
DEBUG
Set true to monitor SAX events and similar diagnostic info. |
private static int |
ENTITY_FIELD_NAME
m_entities name offset. |
private static int |
ENTITY_FIELD_NOTATIONNAME
m_entities notation name offset. |
private static int |
ENTITY_FIELD_PUBLICID
m_entities public ID offset. |
private static int |
ENTITY_FIELD_SYSTEMID
m_entities system ID offset. |
private static int |
ENTITY_FIELDS_PER
Number of entries per record for m_entities. |
protected FastStringBuffer |
m_chars
All the character content, including attribute values, are stored in this buffer. |
private int |
m_coalescedTextType
Type of coalesced text block. |
protected IntStack |
m_contextIndexes
Namespace support, only relevent at construction time. |
protected SuballocatedIntVector |
m_data
This vector holds offset and length data. |
protected SuballocatedIntVector |
m_dataOrQName
Data or qualified name values, one array element for each node. |
protected boolean |
m_endDocumentOccured
End document has been reached. |
private Vector |
m_entities
Vector of entities. |
(package private) static String[] |
m_fixednames
fixed dom-style names. |
protected Hashtable |
m_idAttributes
This table holds the ID string to node associations, for XML IDs. |
private IncrementalSAXSource |
m_incrementalSAXSource
If we're building the model incrementally on demand, we need to be able to tell the source when to send us more data. |
private boolean |
m_insideDTD
We are inside the DTD. |
private org.xml.sax.Locator |
m_locator
The SAX Document locator |
protected IntStack |
m_parents
The parent stack, needed only for construction. |
(package private) boolean |
m_pastFirstElement
|
protected Vector |
m_prefixMappings
Namespace support, only relevent at construction time. |
protected int |
m_previous
The current previous node, needed only for construction time. |
protected IntVector |
m_sourceColumn
Made protected for access by SAX2RTFDTM. |
protected IntVector |
m_sourceLine
Made protected for access by SAX2RTFDTM. |
protected StringVector |
m_sourceSystemId
Made protected for access by SAX2RTFDTM. |
private int |
m_textPendingStart
The starting offset within m_chars for the text or CDATA_SECTION node currently being acumulated, or -1 if there is no text node in progress |
private int |
m_textType
Type of next characters() event within text block in prgress. |
protected boolean |
m_useSourceLocationProperty
Describes whether information about document source location should be maintained or not. |
private DTMStringPool |
m_valuesOrPrefixes
pool of string values that come as strings. |
protected DTMTreeWalker |
m_walker
Tree Walker for dispatchToEvents. |
Fields inherited from class org.apache.xml.dtm.ref.DTMDefaultBase |
m_blocksize, m_documentBaseURI, m_dtmIdent, m_elemIndexes, m_expandedNameTable, m_exptype, m_firstch, m_indexing, m_initialblocksize, m_mgr, m_mgrDefault, m_namespaceDeclSetElements, m_namespaceDeclSets, m_nextsib, m_parent, m_prevsib, m_shouldStripWhitespaceStack, m_shouldStripWS, m_size, m_traversers, m_wsfilter, m_xstrf, NOTPROCESSED |
Fields inherited from interface org.apache.xml.dtm.DTM |
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NAMESPACE_NODE, NOTATION_NODE, NTYPES, NULL, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
Constructor Summary | |
SAX2DTM(DTMManager mgr,
javax.xml.transform.Source source,
int dtmIdentity,
DTMWSFilter whiteSpaceFilter,
XMLStringFactory xstringfactory,
boolean doIndexing)
Construct a SAX2DTM object ready to be constructed from SAX2 ContentHandler events. |
Method Summary | |
protected int |
_dataOrQName(int identity)
Get the data or qualified name for the given node identity. |
protected int |
addNode(int type,
int expandedTypeID,
int parentIndex,
int previousSibling,
int dataOrPrefix,
boolean canHaveFirstChild)
Construct the node map from the node. |
void |
attributeDecl(String eName,
String aName,
String type,
String valueDefault,
String value)
Report an attribute type declaration. |
void |
characters(char[] ch,
int start,
int length)
Receive notification of character data inside an element. |
protected void |
charactersFlush()
Check whether accumulated text should be stripped; if not, append the appropriate flavor of text/cdata node. |
void |
clearCoRoutine()
Ask the CoRoutine parser to doTerminate and clear the reference. |
void |
clearCoRoutine(boolean callDoTerminate)
Ask the CoRoutine parser to doTerminate and clear the reference. |
void |
comment(char[] ch,
int start,
int length)
Report an XML comment anywhere in the document. |
protected boolean |
declAlreadyDeclared(String prefix)
Check if a declaration has already been made for a given prefix. |
void |
dispatchCharactersEvents(int nodeHandle,
org.xml.sax.ContentHandler ch,
boolean normalize)
Directly call the characters method on the passed ContentHandler for the string-value of the given node (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). |
void |
dispatchToEvents(int nodeHandle,
org.xml.sax.ContentHandler ch)
Directly create SAX parser events from a subtree. |
void |
elementDecl(String name,
String model)
Report an element type declaration. |
void |
endCDATA()
Report the end of a CDATA section. |
void |
endDocument()
Receive notification of the end of the document. |
void |
endDTD()
Report the end of DTD declarations. |
void |
endElement(String uri,
String localName,
String qName)
Receive notification of the end of an element. |
void |
endEntity(String name)
Report the end of an entity. |
void |
endPrefixMapping(String prefix)
Receive notification of the end of a Namespace mapping. |
void |
error(org.xml.sax.SAXParseException e)
Receive notification of a recoverable parser error. |
void |
externalEntityDecl(String name,
String publicId,
String systemId)
Report a parsed external entity declaration. |
void |
fatalError(org.xml.sax.SAXParseException e)
Report a fatal XML parsing error. |
int |
getAttributeNode(int nodeHandle,
String namespaceURI,
String name)
Retrieves an attribute node by by qualified name and namespace URI. |
org.xml.sax.ContentHandler |
getContentHandler()
getContentHandler returns "our SAX builder" -- the thing that someone else should send SAX events to in order to extend this DTM model. |
org.xml.sax.ext.DeclHandler |
getDeclHandler()
Return this DTM's DeclHandler. |
String |
getDocumentTypeDeclarationPublicIdentifier()
Return the public identifier of the external subset, normalized as described in 4.2.2 External Entities [XML]. |
String |
getDocumentTypeDeclarationSystemIdentifier()
A document type declaration information item has the following properties: 1. |
org.xml.sax.DTDHandler |
getDTDHandler()
Return this DTM's DTDHandler. |
int |
getElementById(String elementId)
Returns the Element whose ID is given by
elementId . |
org.xml.sax.EntityResolver |
getEntityResolver()
Return this DTM's EntityResolver. |
org.xml.sax.ErrorHandler |
getErrorHandler()
Return this DTM's ErrorHandler. |
org.xml.sax.ext.LexicalHandler |
getLexicalHandler()
Return this DTM's lexical handler. |
String |
getLocalName(int nodeHandle)
Given a node handle, return its XPath-style localname. |
String |
getNamespaceURI(int nodeHandle)
Given a node handle, return its DOM-style namespace URI (As defined in Namespaces, this is the declared URI which this node's prefix -- or default in lieu thereof -- was mapped to.) |
protected int |
getNextNodeIdentity(int identity)
Get the next node identity value in the list, and call the iterator if it hasn't been added yet. |
String |
getNodeName(int nodeHandle)
Given a node handle, return its DOM-style node name. |
String |
getNodeNameX(int nodeHandle)
Given a node handle, return the XPath node name. |
String |
getNodeValue(int nodeHandle)
Given a node handle, return its node value. |
protected int |
getNumberOfNodes()
Get the number of nodes that have been added. |
String |
getPrefix(int nodeHandle)
Given a namespace handle, return the prefix that the namespace decl is mapping. |
private String |
getPrefix(String qname,
String uri)
Get a prefix either from the qname or from the uri mapping, or just make one up! |
javax.xml.transform.SourceLocator |
getSourceLocatorFor(int node)
Retrieve the SourceLocator associated with a specific node. |
XMLString |
getStringValue(int nodeHandle)
Get the string-value of a node as a String object (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). |
String |
getUnparsedEntityURI(String name)
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]). |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable whitespace in element content. |
void |
internalEntityDecl(String name,
String value)
Report an internal entity declaration. |
boolean |
isAttributeSpecified(int attributeHandle)
5. |
private boolean |
isTextType(int type)
Bottleneck determination of text type. |
boolean |
needsTwoThreads()
|
protected boolean |
nextNode()
This method should try and build one or more nodes in the table. |
void |
notationDecl(String name,
String publicId,
String systemId)
Receive notification of a notation declaration. |
void |
processingInstruction(String target,
String data)
Receive notification of a processing instruction. |
org.xml.sax.InputSource |
resolveEntity(String publicId,
String systemId)
Resolve an external entity. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Receive a Locator object for document events. |
void |
setIDAttribute(String id,
int elem)
Set an ID string to node association in the ID table. |
void |
setIncrementalSAXSource(IncrementalSAXSource incrementalSAXSource)
Bind a IncrementalSAXSource to this DTM. |
void |
setProperty(String property,
Object value)
Set a run time property for this DTM instance. |
void |
skippedEntity(String name)
Receive notification of a skipped entity. |
void |
startCDATA()
Report the start of a CDATA section. |
void |
startDocument()
Receive notification of the beginning of the document. |
void |
startDTD(String name,
String publicId,
String systemId)
Report the start of DTD declarations, if any. |
void |
startElement(String uri,
String localName,
String qName,
org.xml.sax.Attributes attributes)
Receive notification of the start of an element. |
void |
startEntity(String name)
Report the beginning of an entity in content. |
void |
startPrefixMapping(String prefix,
String uri)
Receive notification of the start of a Namespace mapping. |
void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
Receive notification of an unparsed entity declaration. |
void |
warning(org.xml.sax.SAXParseException e)
Receive notification of a parser warning. |
Methods inherited from class org.apache.xml.dtm.ref.DTMDefaultBaseIterators |
getAxisIterator, getTypedAxisIterator |
Methods inherited from class org.apache.xml.dtm.ref.DTMDefaultBaseTraversers |
getAxisTraverser |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final boolean DEBUG
private IncrementalSAXSource m_incrementalSAXSource
setIncrementalSAXSource
protected FastStringBuffer m_chars
protected SuballocatedIntVector m_data
protected transient IntStack m_parents
protected transient int m_previous
protected transient Vector m_prefixMappings
protected transient IntStack m_contextIndexes
private transient int m_textType
private transient int m_coalescedTextType
private transient org.xml.sax.Locator m_locator
private transient boolean m_insideDTD
protected DTMTreeWalker m_walker
private DTMStringPool m_valuesOrPrefixes
protected boolean m_endDocumentOccured
protected SuballocatedIntVector m_dataOrQName
protected Hashtable m_idAttributes
static final String[] m_fixednames
private Vector m_entities
private static final int ENTITY_FIELD_PUBLICID
private static final int ENTITY_FIELD_SYSTEMID
private static final int ENTITY_FIELD_NOTATIONNAME
private static final int ENTITY_FIELD_NAME
private static final int ENTITY_FIELDS_PER
private int m_textPendingStart
protected boolean m_useSourceLocationProperty
protected StringVector m_sourceSystemId
protected IntVector m_sourceLine
protected IntVector m_sourceColumn
boolean m_pastFirstElement
Constructor Detail |
public SAX2DTM(DTMManager mgr, javax.xml.transform.Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing)
mgr
- The DTMManager who owns this DTM.source
- the JAXP 1.1 Source object for this DTM.dtmIdentity
- The DTM identity ID for this DTM.whiteSpaceFilter
- The white space filter for this DTM, which may
be null.xstringfactory
- XMLString factory for creating character content.doIndexing
- true if the caller considers it worth it to use
indexing schemes.Method Detail |
protected int _dataOrQName(int identity)
identity
- The node identity.
public void clearCoRoutine()
public void clearCoRoutine(boolean callDoTerminate)
callDoTerminate
- true of doTerminate should be called on the
coRoutine parser.public void setIncrementalSAXSource(IncrementalSAXSource incrementalSAXSource)
incrementalSAXSource
- The parser that we want to recieve events from
on demand.public org.xml.sax.ContentHandler getContentHandler()
getContentHandler
in interface DTM
public org.xml.sax.ext.LexicalHandler getLexicalHandler()
getLexicalHandler
in interface DTM
public org.xml.sax.EntityResolver getEntityResolver()
getEntityResolver
in interface DTM
public org.xml.sax.DTDHandler getDTDHandler()
getDTDHandler
in interface DTM
public org.xml.sax.ErrorHandler getErrorHandler()
getErrorHandler
in interface DTM
public org.xml.sax.ext.DeclHandler getDeclHandler()
getDeclHandler
in interface DTM
public boolean needsTwoThreads()
needsTwoThreads
in interface DTM
public void dispatchCharactersEvents(int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException
dispatchCharactersEvents
in interface DTM
dispatchCharactersEvents
in class DTMDefaultBase
nodeHandle
- The node ID.ch
- A non-null reference to a ContentHandler.normalize
- true if the content should be normalized according to
the rules for the XPath
normalize-space
function.
org.xml.sax.SAXException
public String getNodeName(int nodeHandle)
getNodeName
in interface DTM
getNodeName
in class DTMDefaultBase
nodeHandle
- the id of the node.
public String getNodeNameX(int nodeHandle)
getNodeNameX
in interface DTM
getNodeNameX
in class DTMDefaultBase
nodeHandle
- the id of the node.
public boolean isAttributeSpecified(int attributeHandle)
isAttributeSpecified
in interface DTM
isAttributeSpecified
in class DTMDefaultBase
attributeHandle
- Must be a valid handle to an attribute node.
true
if the attribute was specified;
false
if it was defaulted.public String getDocumentTypeDeclarationSystemIdentifier()
getDocumentTypeDeclarationSystemIdentifier
in interface DTM
getDocumentTypeDeclarationSystemIdentifier
in class DTMDefaultBase
protected int getNextNodeIdentity(int identity)
getNextNodeIdentity
in class DTMDefaultBase
identity
- The node identity (index).
public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException
dispatchToEvents
in interface DTM
dispatchToEvents
in class DTMDefaultBase
nodeHandle
- The node ID.ch
- A non-null reference to a ContentHandler.
org.xml.sax.SAXException
protected int getNumberOfNodes()
getNumberOfNodes
in class DTMDefaultBase
protected boolean nextNode()
nextNode
in class DTMDefaultBase
private final boolean isTextType(int type)
type
- oneof DTM.XXX_NODE.
protected int addNode(int type, int expandedTypeID, int parentIndex, int previousSibling, int dataOrPrefix, boolean canHaveFirstChild)
type
- raw type ID, one of DTM.XXX_NODE.expandedTypeID
- The expended type ID.parentIndex
- The current parent index.previousSibling
- The previous sibling index.dataOrPrefix
- index into m_data table, or string handle.canHaveFirstChild
- true if the node can have a first child, false
if it is atomic.
public String getNodeValue(int nodeHandle)
getNodeValue
in interface DTM
getNodeValue
in class DTMDefaultBase
nodeHandle
- The node id.
public String getLocalName(int nodeHandle)
getLocalName
in interface DTM
getLocalName
in class DTMDefaultBase
nodeHandle
- the id of the node.
public String getUnparsedEntityURI(String name)
XML processors may choose to use the System Identifier (if one is provided) to resolve the entity, rather than the URI in the Public Identifier. The details are dependent on the processor, and we would have to support some form of plug-in resolver to handle this properly. Currently, we simply return the System Identifier if present, and hope that it a usable URI or that our caller can map it to one. TODO: Resolve Public Identifiers... or consider changing function name.
If we find a relative URI reference, XML expects it to be resolved in terms of the base URI of the document. The DOM doesn't do that for us, and it isn't entirely clear whether that should be done here; currently that's pushed up to a higher level of our application. (Note that DOM Level 1 didn't store the document's base URI.) TODO: Consider resolving Relative URIs.
(The DOM's statement that "An XML processor may choose to completely expand entities before the structure model is passed to the DOM" refers only to parsed entities, not unparsed, and hence doesn't affect this function.)
getUnparsedEntityURI
in interface DTM
getUnparsedEntityURI
in class DTMDefaultBase
name
- A string containing the Entity Name of the unparsed
entity.
public String getPrefix(int nodeHandle)
%REVIEW% Are you sure you want "" for no prefix?
%REVIEW-COMMENT% I think so... not totally sure. -sb
getPrefix
in interface DTM
getPrefix
in class DTMDefaultBase
nodeHandle
- the id of the node.
public int getAttributeNode(int nodeHandle, String namespaceURI, String name)
getAttributeNode
in interface DTM
getAttributeNode
in class DTMDefaultBase
nodeHandle
- int Handle of the node upon which to look up this attribute..namespaceURI
- The namespace URI of the attribute to
retrieve, or null.name
- The local name of the attribute to
retrieve.
nodeName
) or DTM.NULL
if there is no such
attribute.public String getDocumentTypeDeclarationPublicIdentifier()
getDocumentTypeDeclarationPublicIdentifier
in interface DTM
getDocumentTypeDeclarationPublicIdentifier
in class DTMDefaultBase
public String getNamespaceURI(int nodeHandle)
%REVIEW% Null or ""? -sb
getNamespaceURI
in interface DTM
getNamespaceURI
in class DTMDefaultBase
nodeHandle
- the id of the node.
public XMLString getStringValue(int nodeHandle)
getStringValue
in interface DTM
getStringValue
in class DTMDefaultBase
nodeHandle
- The node ID.
public int getElementById(String elementId)
Element
whose ID
is given by
elementId
. If no such element exists, returns
DTM.NULL
. Behavior is not defined if more than one element
has this ID
. Attributes (including those
with the name "ID") are not of type ID unless so defined by DTD/Schema
information available to the DTM implementation.
Implementations that do not know whether attributes are of type ID or
not are expected to return DTM.NULL
.
%REVIEW% Presumably IDs are still scoped to a single document, and this operation searches only within a single document, right? Wouldn't want collisions between DTMs in the same process.
getElementById
in interface DTM
getElementById
in class DTMDefaultBase
elementId
- The unique id
value for an element.
private String getPrefix(String qname, String uri)
qname
- The qualified name, which may be null.uri
- The namespace URI, which may be null.
public void setIDAttribute(String id, int elem)
id
- The ID string.elem
- The associated element handle.protected void charactersFlush()
public org.xml.sax.InputSource resolveEntity(String publicId, String systemId) throws org.xml.sax.SAXException
Always return null, so that the parser will use the system identifier provided in the XML document. This method implements the SAX default behaviour: application writers can override it in a subclass to do special translations such as catalog lookups or URI redirection.
resolveEntity
in interface org.xml.sax.EntityResolver
publicId
- The public identifer, or null if none is
available.systemId
- The system identifier provided in the XML
document.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
EntityResolver.resolveEntity(java.lang.String, java.lang.String)
public void notationDecl(String name, String publicId, String systemId) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method in a subclass if they wish to keep track of the notations declared in a document.
notationDecl
in interface org.xml.sax.DTDHandler
name
- The notation name.publicId
- The notation public identifier, or null if not
available.systemId
- The notation system identifier.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method in a subclass to keep track of the unparsed entities declared in a document.
unparsedEntityDecl
in interface org.xml.sax.DTDHandler
name
- The entity name.publicId
- The entity public identifier, or null if not
available.systemId
- The entity system identifier.notationName
- The name of the associated notation.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void setDocumentLocator(org.xml.sax.Locator locator)
By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.
setDocumentLocator
in interface org.xml.sax.ContentHandler
locator
- A locator for all SAX document events.ContentHandler.setDocumentLocator(org.xml.sax.Locator)
,
Locator
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startDocument()
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endDocument()
public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each Namespace prefix scope (such as storing the prefix mapping).
startPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The Namespace prefix being declared.uri
- The Namespace URI mapped to the prefix.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each prefix mapping.
endPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The Namespace prefix being declared.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endPrefixMapping(java.lang.String)
protected boolean declAlreadyDeclared(String prefix)
prefix
- non-null prefix string.
public void startElement(String uri, String localName, String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).
startElement
in interface org.xml.sax.ContentHandler
uri
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName
- The qualified name (with prefix), or the
empty string if qualified names are not available.attributes
- The specified or defaulted attributes.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endElement(String uri, String localName, String qName) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).
endElement
in interface org.xml.sax.ContentHandler
uri
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName
- The qualified XML 1.0 name (with prefix), or the
empty string if qualified names are not available.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).
characters
in interface org.xml.sax.ContentHandler
ch
- The characters.start
- The start position in the character array.length
- The number of characters to use from the
character array.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.characters(char[], int, int)
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method to take specific actions for each chunk of ignorable whitespace (such as adding data to a node or buffer, or printing it to a file).
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ch
- The whitespace characters.start
- The start position in the character array.length
- The number of characters to use from the
character array.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(String target, String data) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method in a subclass to take specific actions for each processing instruction, such as setting status variables or invoking other methods.
processingInstruction
in interface org.xml.sax.ContentHandler
target
- The processing instruction target.data
- The processing instruction data, or null if
none is supplied.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public void skippedEntity(String name) throws org.xml.sax.SAXException
By default, do nothing. Application writers may override this method in a subclass to take specific actions for each processing instruction, such as setting status variables or invoking other methods.
skippedEntity
in interface org.xml.sax.ContentHandler
name
- The name of the skipped entity.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each warning, such as inserting the message in a log file or printing it to the console.
warning
in interface org.xml.sax.ErrorHandler
e
- The warning information encoded as an exception.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.warning(org.xml.sax.SAXParseException)
,
SAXParseException
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each error, such as inserting the message in a log file or printing it to the console.
error
in interface org.xml.sax.ErrorHandler
e
- The warning information encoded as an exception.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.warning(org.xml.sax.SAXParseException)
,
SAXParseException
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
The default implementation throws a SAXParseException. Application writers may override this method in a subclass if they need to take specific actions for each fatal error (such as collecting all of the errors into a single report): in any case, the application must stop all regular processing when this method is invoked, since the document is no longer reliable, and the parser may no longer report parsing events.
fatalError
in interface org.xml.sax.ErrorHandler
e
- The error information encoded as an exception.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.fatalError(org.xml.sax.SAXParseException)
,
SAXParseException
public void elementDecl(String name, String model) throws org.xml.sax.SAXException
The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all whitespace is removed,and will include the enclosing parentheses.
elementDecl
in interface org.xml.sax.ext.DeclHandler
name
- The element type name.model
- The content model as a normalized string.
org.xml.sax.SAXException
- The application may raise an exception.public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws org.xml.sax.SAXException
Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION", or a parenthesized token group with the separator "|" and all whitespace removed.
attributeDecl
in interface org.xml.sax.ext.DeclHandler
eName
- The name of the associated element.aName
- The name of the attribute.type
- A string representing the attribute type.valueDefault
- A string representing the attribute default
("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
none of these applies.value
- A string representing the attribute's default value,
or null if there is none.
org.xml.sax.SAXException
- The application may raise an exception.public void internalEntityDecl(String name, String value) throws org.xml.sax.SAXException
Only the effective (first) declaration for each entity will be reported.
internalEntityDecl
in interface org.xml.sax.ext.DeclHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.value
- The replacement text of the entity.
org.xml.sax.SAXException
- The application may raise an exception.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void externalEntityDecl(String name, String publicId, String systemId) throws org.xml.sax.SAXException
Only the effective (first) declaration for each entity will be reported.
externalEntityDecl
in interface org.xml.sax.ext.DeclHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.publicId
- The declared public identifier of the entity, or
null if none was declared.systemId
- The declared system identifier of the entity.
org.xml.sax.SAXException
- The application may raise an exception.internalEntityDecl(java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void startDTD(String name, String publicId, String systemId) throws org.xml.sax.SAXException
Any declarations are assumed to be in the internal subset
unless otherwise indicated by a startEntity
event.
Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.
startDTD
in interface org.xml.sax.ext.LexicalHandler
name
- The document type name.publicId
- The declared public identifier for the
external DTD subset, or null if none was declared.systemId
- The declared system identifier for the
external DTD subset, or null if none was declared.
org.xml.sax.SAXException
- The application may raise an
exception.endDTD()
,
startEntity(java.lang.String)
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startEntity(String name) throws org.xml.sax.SAXException
NOTE: entity references in attribute values -- and the start and end of the document entity -- are never reported.
The start and end of the external DTD subset are reported using the pseudo-name "[dtd]". All other events must be properly nested within start/end entity events.
Note that skipped entities will be reported through the
skippedEntity
event, which is part of the ContentHandler interface.
startEntity
in interface org.xml.sax.ext.LexicalHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.
org.xml.sax.SAXException
- The application may raise an exception.endEntity(java.lang.String)
,
DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)
,
DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
public void endEntity(String name) throws org.xml.sax.SAXException
endEntity
in interface org.xml.sax.ext.LexicalHandler
name
- The name of the entity that is ending.
org.xml.sax.SAXException
- The application may raise an exception.startEntity(java.lang.String)
public void startCDATA() throws org.xml.sax.SAXException
The contents of the CDATA section will be reported through
the regular characters
event.
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.endCDATA()
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.startCDATA()
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read).
comment
in interface org.xml.sax.ext.LexicalHandler
ch
- An array holding the characters in the comment.start
- The starting position in the array.length
- The number of characters to use from the array.
org.xml.sax.SAXException
- The application may raise an exception.public void setProperty(String property, Object value)
setProperty
in interface DTM
property
- a String
valuevalue
- an Object
valuepublic javax.xml.transform.SourceLocator getSourceLocatorFor(int node)
getSourceLocatorFor
in interface DTM
node
- an int
value
SourceLocator
value or null if no location
is available
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |