|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.event.ReceivingContentHandler
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 |
reset()
Set the ReceivingContentHandler to its initial state, except for the local name cache, which is retained |
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 |
public ReceivingContentHandler()
Method Detail |
public void reset()
public void setReceiver(Receiver e)
public void setPipelineConfiguration(PipelineConfiguration pipe)
public PipelineConfiguration getPipelineConfiguration()
public Configuration getConfiguration()
public void setIgnoreIgnorableWhitespace(boolean ignore)
public boolean isIgnoringIgnorableWhitespace()
setIgnoreIgnorableWhitespace(boolean)
if that has been called; otherwise the value
from the configuration.
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endDocument()
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startDocument()
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
locator
- An object that can return the location of
any SAX document event.Locator
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.endPrefixMapping(java.lang.String)
,
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The prefix that was being mapping.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
,
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
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
startElement
in interface org.xml.sax.ContentHandler
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.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
,
Attributes
public void endElement(java.lang.String uri, java.lang.String localname, java.lang.String rawname) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
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.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.ignorableWhitespace(char[], int, int)
,
Locator
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.characters(char[], int, int)
public void processingInstruction(java.lang.String name, java.lang.String remainder) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
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.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
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.
org.xml.sax.SAXException
- The application may raise an exception.public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.ContentHandler
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.
skippedEntity
in interface org.xml.sax.ContentHandler
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]".
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
startDTD
in interface org.xml.sax.ext.LexicalHandler
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.
org.xml.sax.SAXException
- The application may raise an
exception.LexicalHandler.endDTD()
,
LexicalHandler.startEntity(java.lang.String)
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.LexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.ext.LexicalHandler
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:
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.
startEntity
in interface org.xml.sax.ext.LexicalHandler
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]".
org.xml.sax.SAXException
- The application may raise an exception.LexicalHandler.endEntity(java.lang.String)
,
DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)
,
DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.ext.LexicalHandler
endEntity
in interface org.xml.sax.ext.LexicalHandler
name
- The name of the entity that is ending.
org.xml.sax.SAXException
- The application may raise an exception.LexicalHandler.startEntity(java.lang.String)
public void startCDATA() throws org.xml.sax.SAXException
org.xml.sax.ext.LexicalHandler
The contents of the CDATA section will be reported through
the regular characters
event; this event is intended only to report
the boundary.
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.LexicalHandler.endCDATA()
public void endCDATA() throws org.xml.sax.SAXException
org.xml.sax.ext.LexicalHandler
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.LexicalHandler.startCDATA()
public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
org.xml.sax.DTDHandler
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.
notationDecl
in interface org.xml.sax.DTDHandler
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.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) throws org.xml.sax.SAXException
org.xml.sax.DTDHandler
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.
unparsedEntityDecl
in interface org.xml.sax.DTDHandler
name
- The unparsed entity's name.publicId
- The entity's public identifier, or null if none
was given.systemId
- The entity's system identifier.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
public java.lang.String getSystemId()
getSystemId
in interface org.xml.sax.Locator
Locator.getPublicId()
public java.lang.String getPublicId()
getPublicId
in interface org.xml.sax.Locator
Locator.getSystemId()
public int getLineNumber()
getLineNumber
in interface org.xml.sax.Locator
Locator.getColumnNumber()
public int getColumnNumber()
getColumnNumber
in interface org.xml.sax.Locator
Locator.getLineNumber()
public java.lang.String getSystemId(int locationId)
getSystemId
in interface LocationProvider
public int getLineNumber(int locationId)
getLineNumber
in interface LocationProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |