Package net.sf.saxon.event
Class ReceivingContentHandler
- java.lang.Object
-
- net.sf.saxon.event.ReceivingContentHandler
-
- All Implemented Interfaces:
javax.xml.transform.SourceLocator,LocationProvider,SaxonLocator,SourceLocationProvider,org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.ext.LexicalHandler,org.xml.sax.Locator
- Direct Known Subclasses:
IdentityTransformerHandler,TemplatesHandlerImpl,TransformerHandlerImpl
public class ReceivingContentHandler extends java.lang.Object implements org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, org.xml.sax.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
Constructors Constructor Description ReceivingContentHandler()create a ReceivingContentHandler and initialise variables
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(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()voidendDocument()Callback interface for SAX: not for application usevoidendDTD()Register the end of the DTD.voidendElement(java.lang.String uri, java.lang.String localname, java.lang.String rawname)Callback interface for SAX: not for application usevoidendEntity(java.lang.String name)voidendPrefixMapping(java.lang.String prefix)Callback interface for SAX: not for application useintgetColumnNumber()Return the character position where the current document event ends.ConfigurationgetConfiguration()intgetLineNumber()Return the line number where the current document event ends.intgetLineNumber(int locationId)Get the line number within the document or module containing a particular locationPipelineConfigurationgetPipelineConfiguration()java.lang.StringgetPublicId()Return the public identifier for the current document event.java.lang.StringgetSystemId()Return the public identifier for the current document event.java.lang.StringgetSystemId(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 usebooleanisIgnoringIgnorableWhitespace()Determine whether "ignorable whitespace" is ignored.voidnotationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)voidprocessingInstruction(java.lang.String name, java.lang.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(org.xml.sax.Locator locator)Callback interface for SAX: not for application usevoidsetIgnoreIgnorableWhitespace(boolean ignore)Set whether "ignorable whitespace" should be ignored.voidsetPipelineConfiguration(PipelineConfiguration pipe)voidsetReceiver(Receiver e)voidskippedEntity(java.lang.String name)voidstartCDATA()voidstartDocument()Callback interface for SAX: not for application usevoidstartDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)Register the start of the DTD.voidstartElement(java.lang.String uri, java.lang.String localname, java.lang.String rawname, org.xml.sax.Attributes atts)Callback interface for SAX: not for application usevoidstartEntity(java.lang.String name)voidstartPrefixMapping(java.lang.String prefix, java.lang.String uri)Callback interface for SAX: not for application usevoidunparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
-
-
-
Method Detail
-
reset
public void reset()
Set the ReceivingContentHandler to its initial state, except for the local name cache, which is retained
-
setReceiver
public void setReceiver(Receiver e)
-
setPipelineConfiguration
public void setPipelineConfiguration(PipelineConfiguration pipe)
-
getPipelineConfiguration
public PipelineConfiguration getPipelineConfiguration()
-
getConfiguration
public Configuration 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
public void startDocument() throws org.xml.sax.SAXExceptionCallback interface for SAX: not for application use- Specified by:
startDocumentin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
endDocument
public void endDocument() throws org.xml.sax.SAXExceptionCallback interface for SAX: not for application use- Specified by:
endDocumentin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
Callback interface for SAX: not for application use- Specified by:
setDocumentLocatorin interfaceorg.xml.sax.ContentHandler
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXExceptionCallback interface for SAX: not for application use- Specified by:
startPrefixMappingin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXExceptionCallback interface for SAX: not for application use- Specified by:
endPrefixMappingin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String uri, java.lang.String localname, java.lang.String rawname, org.xml.sax.Attributes atts) throws org.xml.sax.SAXExceptionCallback interface for SAX: not for application use- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localname, java.lang.String rawname) throws org.xml.sax.SAXExceptionCallback interface for SAX: not for application use- Specified by:
endElementin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXExceptionCallback interface for SAX: not for application use- Specified by:
charactersin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXExceptionCallback interface for SAX: not for application use- Specified by:
ignorableWhitespacein interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
processingInstruction
public void processingInstruction(java.lang.String name, java.lang.String remainder) throws org.xml.sax.SAXExceptionCallback interface for SAX: not for application use- Specified by:
processingInstructionin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
comment
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXExceptionCallback interface for SAX (part of LexicalHandler interface): not for application use- Specified by:
commentin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
skippedEntity
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException- Specified by:
skippedEntityin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
startDTD
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXExceptionRegister the start of the DTD. Comments in the DTD are skipped because they are not part of the XPath data model- Specified by:
startDTDin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
endDTD
public void endDTD() throws org.xml.sax.SAXExceptionRegister the end of the DTD. Comments in the DTD are skipped because they are not part of the XPath data model- Specified by:
endDTDin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
startEntity
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException- Specified by:
startEntityin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
endEntity
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException- Specified by:
endEntityin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
startCDATA
public void startCDATA() throws org.xml.sax.SAXException- Specified by:
startCDATAin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
endCDATA
public void endCDATA() throws org.xml.sax.SAXException- Specified by:
endCDATAin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
notationDecl
public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException- Specified by:
notationDeclin interfaceorg.xml.sax.DTDHandler- Throws:
org.xml.sax.SAXException
-
unparsedEntityDecl
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) throws org.xml.sax.SAXException- Specified by:
unparsedEntityDeclin interfaceorg.xml.sax.DTDHandler- Throws:
org.xml.sax.SAXException
-
getSystemId
public java.lang.String getSystemId()
Return the public identifier for the current document event.- Specified by:
getSystemIdin interfaceorg.xml.sax.Locator- Specified by:
getSystemIdin interfacejavax.xml.transform.SourceLocator- Returns:
- A string containing the system identifier, or null if none is available.
-
getPublicId
public java.lang.String getPublicId()
Return the public identifier for the current document event.- Specified by:
getPublicIdin interfaceorg.xml.sax.Locator- Specified by:
getPublicIdin interfacejavax.xml.transform.SourceLocator- 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 interfaceorg.xml.sax.Locator- Specified by:
getLineNumberin interfacejavax.xml.transform.SourceLocator- 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 interfaceorg.xml.sax.Locator- Specified by:
getColumnNumberin interfacejavax.xml.transform.SourceLocator- Returns:
- The column number, or -1 if none is available.
-
getSystemId
public java.lang.String getSystemId(int locationId)
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.
-
-