Package net.sf.saxon.event
Class ReceivingContentHandler
java.lang.Object
net.sf.saxon.event.ReceivingContentHandler
- All Implemented Interfaces:
SourceLocator
,LocationProvider
,SaxonLocator
,SourceLocationProvider
,ContentHandler
,DTDHandler
,LexicalHandler
,Locator
- Direct Known Subclasses:
IdentityTransformerHandler
,TemplatesHandlerImpl
,TransformerHandlerImpl
public class ReceivingContentHandler
extends Object
implements ContentHandler, LexicalHandler, DTDHandler, SaxonLocator, SourceLocationProvider
ReceivingContentHandler is a glue class that provides a standard SAX ContentHandler
interface to a Saxon Receiver. To achieve this it needs to map names supplied
as strings to numeric name codes, for which purpose it needs access to a name
pool. The class also performs the function of assembling adjacent text nodes.
The class was previously named ContentEmitter.
- Author:
- Michael H. Kay
-
Constructor Summary
ConstructorsConstructorDescriptioncreate a ReceivingContentHandler and initialise variables -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) Callback interface for SAX: not for application usevoid
comment
(char[] ch, int start, int length) Callback interface for SAX (part of LexicalHandler interface): not for application usevoid
endCDATA()
void
Callback interface for SAX: not for application usevoid
endDTD()
Register the end of the DTD.void
endElement
(String uri, String localname, String rawname) Callback interface for SAX: not for application usevoid
void
endPrefixMapping
(String prefix) Callback interface for SAX: not for application useint
Return the character position where the current document event ends.int
Return the line number where the current document event ends.int
getLineNumber
(int locationId) Get the line number within the document or module containing a particular locationReturn the public identifier for the current document event.Return the public identifier for the current document event.getSystemId
(int locationId) Get the URI of the document or module containing a particular locationvoid
ignorableWhitespace
(char[] ch, int start, int length) Callback interface for SAX: not for application useboolean
Determine whether "ignorable whitespace" is ignored.void
notationDecl
(String name, String publicId, String systemId) void
processingInstruction
(String name, String remainder) Callback interface for SAX: not for application usevoid
reset()
Set the ReceivingContentHandler to its initial state, except for the local name cache, which is retainedvoid
setDocumentLocator
(Locator locator) Callback interface for SAX: not for application usevoid
setIgnoreIgnorableWhitespace
(boolean ignore) Set whether "ignorable whitespace" should be ignored.void
void
void
skippedEntity
(String name) void
void
Callback interface for SAX: not for application usevoid
Register the start of the DTD.void
startElement
(String uri, String localname, String rawname, Attributes atts) Callback interface for SAX: not for application usevoid
startEntity
(String name) void
startPrefixMapping
(String prefix, String uri) Callback interface for SAX: not for application usevoid
unparsedEntityDecl
(String name, String publicId, String systemId, String notationName) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
ReceivingContentHandler
public ReceivingContentHandler()create a ReceivingContentHandler and initialise variables
-
-
Method Details
-
reset
public void reset()Set the ReceivingContentHandler to its initial state, except for the local name cache, which is retained -
setReceiver
-
setPipelineConfiguration
-
getPipelineConfiguration
-
getConfiguration
-
setIgnoreIgnorableWhitespace
public void setIgnoreIgnorableWhitespace(boolean ignore) Set whether "ignorable whitespace" should be ignored. This method is effective only if called after setPipelineConfiguration, since the default value is taken from the configuration. -
isIgnoringIgnorableWhitespace
public boolean isIgnoringIgnorableWhitespace()Determine whether "ignorable whitespace" is ignored. This returns the value that was set usingsetIgnoreIgnorableWhitespace(boolean)
if that has been called; otherwise the value from the configuration. -
startDocument
Callback interface for SAX: not for application use- Specified by:
startDocument
in interfaceContentHandler
- Throws:
SAXException
-
endDocument
Callback interface for SAX: not for application use- Specified by:
endDocument
in interfaceContentHandler
- Throws:
SAXException
-
setDocumentLocator
Callback interface for SAX: not for application use- Specified by:
setDocumentLocator
in interfaceContentHandler
-
startPrefixMapping
Callback interface for SAX: not for application use- Specified by:
startPrefixMapping
in interfaceContentHandler
- Throws:
SAXException
-
endPrefixMapping
Callback interface for SAX: not for application use- Specified by:
endPrefixMapping
in interfaceContentHandler
- Throws:
SAXException
-
startElement
public void startElement(String uri, String localname, String rawname, Attributes atts) throws SAXException Callback interface for SAX: not for application use- Specified by:
startElement
in interfaceContentHandler
- Throws:
SAXException
-
endElement
Callback interface for SAX: not for application use- Specified by:
endElement
in interfaceContentHandler
- Throws:
SAXException
-
characters
Callback interface for SAX: not for application use- Specified by:
characters
in interfaceContentHandler
- Throws:
SAXException
-
ignorableWhitespace
Callback interface for SAX: not for application use- Specified by:
ignorableWhitespace
in interfaceContentHandler
- Throws:
SAXException
-
processingInstruction
Callback interface for SAX: not for application use- Specified by:
processingInstruction
in interfaceContentHandler
- Throws:
SAXException
-
comment
Callback interface for SAX (part of LexicalHandler interface): not for application use- Specified by:
comment
in interfaceLexicalHandler
- Throws:
SAXException
-
skippedEntity
- Specified by:
skippedEntity
in interfaceContentHandler
- Throws:
SAXException
-
startDTD
Register the start of the DTD. Comments in the DTD are skipped because they are not part of the XPath data model- Specified by:
startDTD
in interfaceLexicalHandler
- Throws:
SAXException
-
endDTD
Register the end of the DTD. Comments in the DTD are skipped because they are not part of the XPath data model- Specified by:
endDTD
in interfaceLexicalHandler
- Throws:
SAXException
-
startEntity
- Specified by:
startEntity
in interfaceLexicalHandler
- Throws:
SAXException
-
endEntity
- Specified by:
endEntity
in interfaceLexicalHandler
- Throws:
SAXException
-
startCDATA
- Specified by:
startCDATA
in interfaceLexicalHandler
- Throws:
SAXException
-
endCDATA
- Specified by:
endCDATA
in interfaceLexicalHandler
- Throws:
SAXException
-
notationDecl
- Specified by:
notationDecl
in interfaceDTDHandler
- Throws:
SAXException
-
unparsedEntityDecl
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException - Specified by:
unparsedEntityDecl
in interfaceDTDHandler
- Throws:
SAXException
-
getSystemId
Return the public identifier for the current document event.- Specified by:
getSystemId
in interfaceLocator
- Specified by:
getSystemId
in interfaceSourceLocator
- Returns:
- A string containing the system identifier, or null if none is available.
-
getPublicId
Return the public identifier for the current document event.- Specified by:
getPublicId
in interfaceLocator
- Specified by:
getPublicId
in interfaceSourceLocator
- Returns:
- A string containing the public identifier, or null if none is available.
-
getLineNumber
public int getLineNumber()Return the line number where the current document event ends.- Specified by:
getLineNumber
in interfaceLocator
- Specified by:
getLineNumber
in interfaceSourceLocator
- Returns:
- The line number, or -1 if none is available.
-
getColumnNumber
public int getColumnNumber()Return the character position where the current document event ends.- Specified by:
getColumnNumber
in interfaceLocator
- Specified by:
getColumnNumber
in interfaceSourceLocator
- Returns:
- The column number, or -1 if none is available.
-
getSystemId
Description copied from interface:LocationProvider
Get the URI of the document or module containing a particular location- Specified by:
getSystemId
in interfaceLocationProvider
- Parameters:
locationId
- identifier of the location in question (as passed down the Receiver pipeline)- Returns:
- the URI of the document or module.
-
getLineNumber
public int getLineNumber(int locationId) Description copied from interface:LocationProvider
Get the line number within the document or module containing a particular location- Specified by:
getLineNumber
in interfaceLocationProvider
- Parameters:
locationId
- identifier of the location in question (as passed down the Receiver pipeline)- Returns:
- the line number within the document or module.
-