net.sf.saxon.event
Class ReceivingContentHandler

java.lang.Object
  extended by 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
ReceivingContentHandler()
          create a ReceivingContentHandler and initialise variables
 
Method Summary
 void characters(char[] ch, int start, int length)
          Callback interface for SAX: not for application use
 void comment(char[] ch, int start, int length)
          Callback interface for SAX (part of LexicalHandler interface): not for application use
 void endCDATA()
           
 void endDocument()
          Callback interface for SAX: not for application use
 void endDTD()
          Register the end of the DTD.
 void endElement(String uri, String localname, String rawname)
          Callback interface for SAX: not for application use
 void endEntity(String name)
           
 void endPrefixMapping(String prefix)
          Callback interface for SAX: not for application use
 int getColumnNumber()
          Return the character position where the current document event ends.
 Configuration getConfiguration()
           
 int getLineNumber()
          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 location
 PipelineConfiguration getPipelineConfiguration()
           
 String getPublicId()
          Return the public identifier for the current document event.
 String getSystemId()
          Return the public identifier for the current document event.
 String getSystemId(int locationId)
          Get the URI of the document or module containing a particular location
 void ignorableWhitespace(char[] ch, int start, int length)
          Callback interface for SAX: not for application use
 boolean isIgnoringIgnorableWhitespace()
          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 use
 void reset()
          Set the ReceivingContentHandler to its initial state, except for the local name cache, which is retained
 void setDocumentLocator(Locator locator)
          Callback interface for SAX: not for application use
 void setIgnoreIgnorableWhitespace(boolean ignore)
          Set whether "ignorable whitespace" should be ignored.
 void setPipelineConfiguration(PipelineConfiguration pipe)
           
 void setReceiver(Receiver e)
           
 void skippedEntity(String name)
           
 void startCDATA()
           
 void startDocument()
          Callback interface for SAX: not for application use
 void startDTD(String name, String publicId, String systemId)
          Register the start of the DTD.
 void startElement(String uri, String localname, String rawname, Attributes atts)
          Callback interface for SAX: not for application use
 void startEntity(String name)
           
 void startPrefixMapping(String prefix, String uri)
          Callback interface for SAX: not for application use
 void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReceivingContentHandler

public ReceivingContentHandler()
create a ReceivingContentHandler and initialise variables

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 using setIgnoreIgnorableWhitespace(boolean) if that has been called; otherwise the value from the configuration.


startDocument

public void startDocument()
                   throws SAXException
Callback interface for SAX: not for application use

Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Callback interface for SAX: not for application use

Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

setDocumentLocator

public void setDocumentLocator(Locator locator)
Callback interface for SAX: not for application use

Specified by:
setDocumentLocator in interface ContentHandler

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Callback interface for SAX: not for application use

Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Callback interface for SAX: not for application use

Specified by:
endPrefixMapping in interface ContentHandler
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 interface ContentHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localname,
                       String rawname)
                throws SAXException
Callback interface for SAX: not for application use

Specified by:
endElement in interface ContentHandler
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Callback interface for SAX: not for application use

Specified by:
characters in interface ContentHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Callback interface for SAX: not for application use

Specified by:
ignorableWhitespace in interface ContentHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String name,
                                  String remainder)
                           throws SAXException
Callback interface for SAX: not for application use

Specified by:
processingInstruction in interface ContentHandler
Throws:
SAXException

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Callback interface for SAX (part of LexicalHandler interface): not for application use

Specified by:
comment in interface LexicalHandler
Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Specified by:
skippedEntity in interface ContentHandler
Throws:
SAXException

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
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 interface LexicalHandler
Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
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 interface LexicalHandler
Throws:
SAXException

startEntity

public void startEntity(String name)
                 throws SAXException
Specified by:
startEntity in interface LexicalHandler
Throws:
SAXException

endEntity

public void endEntity(String name)
               throws SAXException
Specified by:
endEntity in interface LexicalHandler
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Specified by:
startCDATA in interface LexicalHandler
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Specified by:
endCDATA in interface LexicalHandler
Throws:
SAXException

notationDecl

public void notationDecl(String name,
                         String publicId,
                         String systemId)
                  throws SAXException
Specified by:
notationDecl in interface DTDHandler
Throws:
SAXException

unparsedEntityDecl

public void unparsedEntityDecl(String name,
                               String publicId,
                               String systemId,
                               String notationName)
                        throws SAXException
Specified by:
unparsedEntityDecl in interface DTDHandler
Throws:
SAXException

getSystemId

public String getSystemId()
Return the public identifier for the current document event.

Specified by:
getSystemId in interface SourceLocator
Specified by:
getSystemId in interface Locator
Returns:
A string containing the system identifier, or null if none is available.

getPublicId

public String getPublicId()
Return the public identifier for the current document event.

Specified by:
getPublicId in interface SourceLocator
Specified by:
getPublicId in interface Locator
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 interface SourceLocator
Specified by:
getLineNumber in interface Locator
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 interface SourceLocator
Specified by:
getColumnNumber in interface Locator
Returns:
The column number, or -1 if none is available.

getSystemId

public String getSystemId(int locationId)
Description copied from interface: LocationProvider
Get the URI of the document or module containing a particular location

Specified by:
getSystemId in interface LocationProvider
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 interface LocationProvider
Parameters:
locationId - identifier of the location in question (as passed down the Receiver pipeline)
Returns:
the line number within the document or module.


Copyright (C) Michael H. Kay. All rights reserved.