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 TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) Callback interface for SAX: not for application usevoidcomment(char[] ch, int start, int length) Callback interface for SAX (part of LexicalHandler interface): not for application usevoidendCDATA()voidCallback interface for SAX: not for application usevoidendDTD()Register the end of the DTD.voidendElement(String uri, String localname, String rawname) Callback interface for SAX: not for application usevoidvoidendPrefixMapping(String prefix) Callback interface for SAX: not for application useintReturn the character position where the current document event ends.intReturn the line number where the current document event ends.intgetLineNumber(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 locationvoidignorableWhitespace(char[] ch, int start, int length) Callback interface for SAX: not for application usebooleanDetermine whether "ignorable whitespace" is ignored.voidnotationDecl(String name, String publicId, String systemId) voidprocessingInstruction(String name, String remainder) Callback interface for SAX: not for application usevoidreset()Set the ReceivingContentHandler to its initial state, except for the local name cache, which is retainedvoidsetDocumentLocator(Locator locator) Callback interface for SAX: not for application usevoidsetIgnoreIgnorableWhitespace(boolean ignore) Set whether "ignorable whitespace" should be ignored.voidvoidvoidskippedEntity(String name) voidvoidCallback interface for SAX: not for application usevoidRegister the start of the DTD.voidstartElement(String uri, String localname, String rawname, Attributes atts) Callback interface for SAX: not for application usevoidstartEntity(String name) voidstartPrefixMapping(String prefix, String uri) Callback interface for SAX: not for application usevoidunparsedEntityDecl(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, waitMethods 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:
startDocumentin interfaceContentHandler- Throws:
SAXException
-
endDocument
Callback interface for SAX: not for application use- Specified by:
endDocumentin interfaceContentHandler- Throws:
SAXException
-
setDocumentLocator
Callback interface for SAX: not for application use- Specified by:
setDocumentLocatorin interfaceContentHandler
-
startPrefixMapping
Callback interface for SAX: not for application use- Specified by:
startPrefixMappingin interfaceContentHandler- Throws:
SAXException
-
endPrefixMapping
Callback interface for SAX: not for application use- Specified by:
endPrefixMappingin 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:
startElementin interfaceContentHandler- Throws:
SAXException
-
endElement
Callback interface for SAX: not for application use- Specified by:
endElementin interfaceContentHandler- Throws:
SAXException
-
characters
Callback interface for SAX: not for application use- Specified by:
charactersin interfaceContentHandler- Throws:
SAXException
-
ignorableWhitespace
Callback interface for SAX: not for application use- Specified by:
ignorableWhitespacein interfaceContentHandler- Throws:
SAXException
-
processingInstruction
Callback interface for SAX: not for application use- Specified by:
processingInstructionin interfaceContentHandler- Throws:
SAXException
-
comment
Callback interface for SAX (part of LexicalHandler interface): not for application use- Specified by:
commentin interfaceLexicalHandler- Throws:
SAXException
-
skippedEntity
- Specified by:
skippedEntityin 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:
startDTDin 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:
endDTDin interfaceLexicalHandler- Throws:
SAXException
-
startEntity
- Specified by:
startEntityin interfaceLexicalHandler- Throws:
SAXException
-
endEntity
- Specified by:
endEntityin interfaceLexicalHandler- Throws:
SAXException
-
startCDATA
- Specified by:
startCDATAin interfaceLexicalHandler- Throws:
SAXException
-
endCDATA
- Specified by:
endCDATAin interfaceLexicalHandler- Throws:
SAXException
-
notationDecl
- Specified by:
notationDeclin interfaceDTDHandler- Throws:
SAXException
-
unparsedEntityDecl
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException - Specified by:
unparsedEntityDeclin interfaceDTDHandler- Throws:
SAXException
-
getSystemId
Return the public identifier for the current document event.- Specified by:
getSystemIdin interfaceLocator- Specified by:
getSystemIdin 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:
getPublicIdin interfaceLocator- Specified by:
getPublicIdin 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:
getLineNumberin interfaceLocator- Specified by:
getLineNumberin 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:
getColumnNumberin interfaceLocator- Specified by:
getColumnNumberin interfaceSourceLocator- Returns:
- The column number, or -1 if none is available.
-
getSystemId
Description copied from interface:LocationProviderGet the URI of the document or module containing a particular location- Specified by:
getSystemIdin 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:LocationProviderGet the line number within the document or module containing a particular location- Specified by:
getLineNumberin interfaceLocationProvider- Parameters:
locationId- identifier of the location in question (as passed down the Receiver pipeline)- Returns:
- the line number within the document or module.
-