Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.event
Class ReceivingContentHandler

    java.lang.Object
      net.sf.saxon.event.ReceivingContentHandler

All Implemented Interfaces:
  org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.ext.LexicalHandler, LocationProvider, org.xml.sax.Locator, SaxonLocator, javax.xml.transform.SourceLocator

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

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.

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()` Report the end of a CDATA section.
`void` | `endDocument()` Callback interface for SAX: not for application use
`void` | `endDTD()` Register the end of the DTD.
`void` | `endElement(java.lang.String uri, java.lang.String localname, java.lang.String rawname)` Callback interface for SAX: not for application use
`void` | `endEntity(java.lang.String name)` Report the end of an entity.
`void` | `endPrefixMapping(java.lang.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)`
`PipelineConfiguration` | `getPipelineConfiguration()`
`java.lang.String` | `getPublicId()` Return the public identifier for the current document event.
`java.lang.String` | `getSystemId()` Return the public identifier for the current document event.
`java.lang.String` | `getSystemId(int locationId)`
`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(java.lang.String name, java.lang.String publicId, java.lang.String systemId)` Receive notification of a notation declaration event.
`void` | `processingInstruction(java.lang.String name, java.lang.String remainder)` Callback interface for SAX: not for application use
`void` | `setDocumentLocator(org.xml.sax.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(java.lang.String name)` Receive notification of a skipped entity.
`void` | `startCDATA()` Report the start of a CDATA section.
`void` | `startDocument()` Callback interface for SAX: not for application use
`void` | `startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)` Register the start of the DTD.
`void` | `startElement(java.lang.String uri, java.lang.String localname, java.lang.String rawname, org.xml.sax.Attributes atts)` Callback interface for SAX: not for application use
`void` | `startEntity(java.lang.String name)` Report the beginning of some internal and external XML entities.
`void` | `startPrefixMapping(java.lang.String prefix, java.lang.String uri)` Callback interface for SAX: not for application use
`void` | `unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)` Receive notification of an unparsed entity declaration event.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReceivingContentHandler

    public ReceivingContentHandler()

  create a ReceivingContentHandler and initialise variables

Method Detail

### 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 org.xml.sax.SAXException

  Callback interface for SAX: not for application use

  Specified by:
    `startDocument` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.endDocument()`

### endDocument

    public void endDocument()
                     throws org.xml.sax.SAXException

  Callback interface for SAX: not for application use

  Specified by:
    `endDocument` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.startDocument()`

### setDocumentLocator

    public void setDocumentLocator(org.xml.sax.Locator locator)

  Callback interface for SAX: not for application use

  Specified by:
    `setDocumentLocator` in interface `org.xml.sax.ContentHandler`
  Parameters:
    `locator` - An object that can return the location of any SAX document event.
  See Also:
    `Locator`

### startPrefixMapping

    public void startPrefixMapping(java.lang.String prefix,
                                   java.lang.String uri)
                            throws org.xml.sax.SAXException

  Callback interface for SAX: not for application use

  Specified by:
    `startPrefixMapping` in interface `org.xml.sax.ContentHandler`
  Parameters:
    `prefix` - The Namespace prefix being declared.
    `uri` - The Namespace URI the prefix is mapped to.
  Throws:
    `org.xml.sax.SAXException` - The client may throw an exception during processing.
  See Also:
    `ContentHandler.endPrefixMapping(java.lang.String)`, `ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)`

### endPrefixMapping

    public void endPrefixMapping(java.lang.String prefix)
                          throws org.xml.sax.SAXException

  Callback interface for SAX: not for application use

  Specified by:
    `endPrefixMapping` in interface `org.xml.sax.ContentHandler`
  Parameters:
    `prefix` - The prefix that was being mapping.
  Throws:
    `org.xml.sax.SAXException` - The client may throw an exception during processing.
  See Also:
    `ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)`, `ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)`

### 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.SAXException

  Callback interface for SAX: not for application use

  Specified by:
    `startElement` in interface `org.xml.sax.ContentHandler`
  Parameters:
    `localname` - The local name (without prefix), or the empty string if Namespace processing is not being performed.
    `rawname` - The qualified name (with prefix), or the empty string if qualified names are not available.
    `atts` - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)`, `Attributes`

### endElement

    public void endElement(java.lang.String uri,
                           java.lang.String localname,
                           java.lang.String rawname)
                    throws org.xml.sax.SAXException

  Callback interface for SAX: not for application use

  Specified by:
    `endElement` in interface `org.xml.sax.ContentHandler`
  Parameters:
    `localname` - The local name (without prefix), or the empty string if Namespace processing is not being performed.
    `rawname` - The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.

### characters

    public void characters(char[] ch,
                           int start,
                           int length)
                    throws org.xml.sax.SAXException

  Callback interface for SAX: not for application use

  Specified by:
    `characters` in interface `org.xml.sax.ContentHandler`
  Parameters:
    `ch` - The characters from the XML document.
    `start` - The start position in the array.
    `length` - The number of characters to read from the array.
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.ignorableWhitespace(char[], int, int)`, `Locator`

### ignorableWhitespace

    public void ignorableWhitespace(char[] ch,
                                    int start,
                                    int length)
                             throws org.xml.sax.SAXException

  Callback interface for SAX: not for application use

  Specified by:
    `ignorableWhitespace` in interface `org.xml.sax.ContentHandler`
  Parameters:
    `ch` - The characters from the XML document.
    `start` - The start position in the array.
    `length` - The number of characters to read from the array.
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.characters(char[], int, int)`

### processingInstruction

    public void processingInstruction(java.lang.String name,
                                      java.lang.String remainder)
                               throws org.xml.sax.SAXException

  Callback interface for SAX: not for application use

  Specified by:
    `processingInstruction` in interface `org.xml.sax.ContentHandler`
  Parameters:
    `name` - The processing instruction target.
    `remainder` - The processing instruction data, or null if none was supplied. The data does not include any whitespace separating it from the target.
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.

### comment

    public void comment(char[] ch,
                        int start,
                        int length)
                 throws org.xml.sax.SAXException

  Callback interface for SAX (part of LexicalHandler interface): not for application use

  Specified by:
    `comment` in interface `org.xml.sax.ext.LexicalHandler`
  Parameters:
    `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.
  Throws:
    `org.xml.sax.SAXException` - The application may raise an exception.

### skippedEntity

    public void skippedEntity(java.lang.String name)
                       throws org.xml.sax.SAXException

  Description copied from interface: `org.xml.sax.ContentHandler`
  Receive notification of a skipped entity.

  The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the `http://xml.org/sax/features/external-general-entities` and the `http://xml.org/sax/features/external-parameter-entities` properties.

  Specified by:
    `skippedEntity` in interface `org.xml.sax.ContentHandler`
  Parameters:
    `name` - The name of the skipped entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be the string "[dtd]".
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.

### startDTD

    public void startDTD(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws org.xml.sax.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 `org.xml.sax.ext.LexicalHandler`
  Parameters:
    `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.
  Throws:
    `org.xml.sax.SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.endDTD()`, `LexicalHandler.startEntity(java.lang.String)`

### endDTD

    public void endDTD()
                throws org.xml.sax.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 `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)`

### startEntity

    public void startEntity(java.lang.String name)
                     throws org.xml.sax.SAXException

  Description copied from interface: `org.xml.sax.ext.LexicalHandler`
  Report the beginning of some internal and external XML entities.

  The reporting of parameter entities (including the external DTD subset) is optional, and SAX2 drivers that support LexicalHandler may not support it; you can use the `http://xml.org/sax/features/lexical-handler/parameter-entities` feature to query or control the reporting of parameter entities.

  General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]".

  When a SAX2 driver is providing these events, all other events must be properly nested within start/end entity events. There is no additional requirement that events from `DeclHandler` or `DTDHandler` be properly ordered.

  Note that skipped entities will be reported through the `skippedEntity` event, which is part of the ContentHandler interface.

  Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:

  - general entities within attribute values
  - parameter entities within declarations

  These will be silently expanded, with no indication of where the original entity boundaries were.

  Note also that the boundaries of character references (which are not really entities anyway) are not reported.

  All start/endEntity events must be properly nested.

  Specified by:
    `startEntity` in interface `org.xml.sax.ext.LexicalHandler`
  Parameters:
    `name` - The name of the entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be "[dtd]".
  Throws:
    `org.xml.sax.SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.endEntity(java.lang.String)`, `DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)`, `DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)`

### endEntity

    public void endEntity(java.lang.String name)
                   throws org.xml.sax.SAXException

  Description copied from interface: `org.xml.sax.ext.LexicalHandler`
  Report the end of an entity.

  Specified by:
    `endEntity` in interface `org.xml.sax.ext.LexicalHandler`
  Parameters:
    `name` - The name of the entity that is ending.
  Throws:
    `org.xml.sax.SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.startEntity(java.lang.String)`

### startCDATA

    public void startCDATA()
                    throws org.xml.sax.SAXException

  Description copied from interface: `org.xml.sax.ext.LexicalHandler`
  Report the start of a CDATA section.

  The contents of the CDATA section will be reported through the regular `characters` event; this event is intended only to report the boundary.

  Specified by:
    `startCDATA` in interface `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.endCDATA()`

### endCDATA

    public void endCDATA()
                  throws org.xml.sax.SAXException

  Description copied from interface: `org.xml.sax.ext.LexicalHandler`
  Report the end of a CDATA section.

  Specified by:
    `endCDATA` in interface `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.startCDATA()`

### notationDecl

    public void notationDecl(java.lang.String name,
                             java.lang.String publicId,
                             java.lang.String systemId)
                      throws org.xml.sax.SAXException

  Description copied from interface: `org.xml.sax.DTDHandler`
  Receive notification of a notation declaration event.

  It is up to the application to record the notation for later reference, if necessary.

  At least one of publicId and systemId must be non-null. If a system identifier is present, and it is a URL, the SAX parser must resolve it fully before passing it to the application through this event.

  There is no guarantee that the notation declaration will be reported before any unparsed entities that use it.

  Specified by:
    `notationDecl` in interface `org.xml.sax.DTDHandler`
  Parameters:
    `name` - The notation name.
    `publicId` - The notation's public identifier, or null if none was given.
    `systemId` - The notation's system identifier, or null if none was given.
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)`, `AttributeList`

### 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

  Description copied from interface: `org.xml.sax.DTDHandler`
  Receive notification of an unparsed entity declaration event.

  Note that the notation name corresponds to a notation reported by the `notationDecl` event. It is up to the application to record the entity for later reference, if necessary.

  If the system identifier is a URL, the parser must resolve it fully before passing it to the application.

  Specified by:
    `unparsedEntityDecl` in interface `org.xml.sax.DTDHandler`
  Parameters:
    `name` - The unparsed entity's name.
    `publicId` - The entity's public identifier, or null if none was given.
    `systemId` - The entity's system identifier.
  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)`, `AttributeList`

### getSystemId

    public java.lang.String getSystemId()

  Return the public identifier for the current document event.

  Specified by:
    `getSystemId` in interface `org.xml.sax.Locator`
  Returns:
    A string containing the system identifier, or null if none is available.
  See Also:
    `Locator.getPublicId()`

### getPublicId

    public java.lang.String getPublicId()

  Return the public identifier for the current document event.

  Specified by:
    `getPublicId` in interface `org.xml.sax.Locator`
  Returns:
    A string containing the public identifier, or null if none is available.
  See Also:
    `Locator.getSystemId()`

### getLineNumber

    public int getLineNumber()

  Return the line number where the current document event ends.

  Specified by:
    `getLineNumber` in interface `org.xml.sax.Locator`
  Returns:
    The line number, or -1 if none is available.
  See Also:
    `Locator.getColumnNumber()`

### getColumnNumber

    public int getColumnNumber()

  Return the character position where the current document event ends.

  Specified by:
    `getColumnNumber` in interface `org.xml.sax.Locator`
  Returns:
    The column number, or -1 if none is available.
  See Also:
    `Locator.getLineNumber()`

### getSystemId

    public java.lang.String getSystemId(int locationId)

  Specified by:
    `getSystemId` in interface `LocationProvider`

### getLineNumber

    public int getLineNumber(int locationId)

  Specified by:
    `getLineNumber` in interface `LocationProvider`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD