Public Member Functions | |
SAXOutputter () | |
SAXOutputter (ContentHandler contentHandler) | |
SAXOutputter (ContentHandler contentHandler, ErrorHandler errorHandler, DTDHandler dtdHandler, EntityResolver entityResolver) | |
SAXOutputter (ContentHandler contentHandler, ErrorHandler errorHandler, DTDHandler dtdHandler, EntityResolver entityResolver, LexicalHandler lexicalHandler) | |
void | setContentHandler (ContentHandler contentHandler) |
ContentHandler | getContentHandler () |
void | setErrorHandler (ErrorHandler errorHandler) |
ErrorHandler | getErrorHandler () |
void | setDTDHandler (DTDHandler dtdHandler) |
DTDHandler | getDTDHandler () |
void | setEntityResolver (EntityResolver entityResolver) |
EntityResolver | getEntityResolver () |
void | setLexicalHandler (LexicalHandler lexicalHandler) |
LexicalHandler | getLexicalHandler () |
void | setDeclHandler (DeclHandler declHandler) |
DeclHandler | getDeclHandler () |
void | setReportNamespaceDeclarations (boolean declareNamespaces) |
void | setReportDTDEvents (boolean reportDtdEvents) |
void | setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException |
boolean | getFeature (String name) throws SAXNotRecognizedException, SAXNotSupportedException |
void | setProperty (String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException |
Object | getProperty (String name) throws SAXNotRecognizedException, SAXNotSupportedException |
void | output (Document document) throws JDOMException |
void | output (List nodes) throws JDOMException |
JDOMLocator | getLocator () |
Protected Member Functions | |
void | handleError (JDOMException exception) throws JDOMException |
XMLReader | createParser () throws Exception |
SAXOutputter
takes a JDOM tree and fires SAX2 events.
Most ContentHandler
callbacks are supported. Both ignorableWhitespace
and skippedEntity
have not been implemented. The setDocumentLocator
callback has been implemented, but the locator object always returns -1 for getColumnNumber
and getLineNumber
.
The EntityResolver
callback resolveEntity
has been implemented for DTDs.
At this time, it is not possible to access notations and unparsed entity references in a DTD from a JDOM tree. Therefore, DTDHandler
callbacks have not been implemented yet.
The ErrorHandler
callbacks have not been implemented, since these are supposed to be invoked when the document is parsed. However, the document has already been parsed in order to create the JDOM tree.
org::jdom::output::SAXOutputter::SAXOutputter | ( | ) | [inline] |
This will create a SAXOutputter
without any registered handler. The application is then responsible for registering them using the setXxxHandler()
methods.
org::jdom::output::SAXOutputter::SAXOutputter | ( | ContentHandler | contentHandler | ) | [inline] |
This will create a SAXOutputter
with the specified ContentHandler
.
contentHandler | contains ContentHandler callback methods |
org::jdom::output::SAXOutputter::SAXOutputter | ( | ContentHandler | contentHandler, | |
ErrorHandler | errorHandler, | |||
DTDHandler | dtdHandler, | |||
EntityResolver | entityResolver | |||
) | [inline] |
This will create a SAXOutputter
with the specified SAX2 handlers. At this time, only ContentHandler
and EntityResolver
are supported.
contentHandler | contains ContentHandler callback methods | |
errorHandler | contains ErrorHandler callback methods | |
dtdHandler | contains DTDHandler callback methods | |
entityResolver | contains EntityResolver callback methods |
org::jdom::output::SAXOutputter::SAXOutputter | ( | ContentHandler | contentHandler, | |
ErrorHandler | errorHandler, | |||
DTDHandler | dtdHandler, | |||
EntityResolver | entityResolver, | |||
LexicalHandler | lexicalHandler | |||
) | [inline] |
This will create a SAXOutputter
with the specified SAX2 handlers. At this time, only ContentHandler
and EntityResolver
are supported.
contentHandler | contains ContentHandler callback methods | |
errorHandler | contains ErrorHandler callback methods | |
dtdHandler | contains DTDHandler callback methods | |
entityResolver | contains EntityResolver callback methods | |
lexicalHandler | contains LexicalHandler callbacks. |
void org::jdom::output::SAXOutputter::setContentHandler | ( | ContentHandler | contentHandler | ) | [inline] |
This will set the ContentHandler
.
contentHandler | contains ContentHandler callback methods. |
ContentHandler org::jdom::output::SAXOutputter::getContentHandler | ( | ) | [inline] |
Returns the registered ContentHandler
.
ContentHandler
or null
if none was registered. void org::jdom::output::SAXOutputter::setErrorHandler | ( | ErrorHandler | errorHandler | ) | [inline] |
This will set the ErrorHandler
.
errorHandler | contains ErrorHandler callback methods. |
ErrorHandler org::jdom::output::SAXOutputter::getErrorHandler | ( | ) | [inline] |
Return the registered ErrorHandler
.
ErrorHandler
or null
if none was registered. void org::jdom::output::SAXOutputter::setDTDHandler | ( | DTDHandler | dtdHandler | ) | [inline] |
This will set the DTDHandler
.
dtdHandler | contains DTDHandler callback methods. |
DTDHandler org::jdom::output::SAXOutputter::getDTDHandler | ( | ) | [inline] |
Return the registered DTDHandler
.
DTDHandler
or null
if none was registered. void org::jdom::output::SAXOutputter::setEntityResolver | ( | EntityResolver | entityResolver | ) | [inline] |
This will set the EntityResolver
.
entityResolver | contains EntityResolver callback methods. |
EntityResolver org::jdom::output::SAXOutputter::getEntityResolver | ( | ) | [inline] |
Return the registered EntityResolver
.
EntityResolver
or null
if none was registered. void org::jdom::output::SAXOutputter::setLexicalHandler | ( | LexicalHandler | lexicalHandler | ) | [inline] |
This will set the LexicalHandler
.
lexicalHandler | contains lexical callback methods. |
LexicalHandler org::jdom::output::SAXOutputter::getLexicalHandler | ( | ) | [inline] |
Return the registered LexicalHandler
.
LexicalHandler
or null
if none was registered. void org::jdom::output::SAXOutputter::setDeclHandler | ( | DeclHandler | declHandler | ) | [inline] |
This will set the DeclHandler
.
declHandler | contains declaration callback methods. |
DeclHandler org::jdom::output::SAXOutputter::getDeclHandler | ( | ) | [inline] |
Return the registered DeclHandler
.
DeclHandler
or null
if none was registered. void org::jdom::output::SAXOutputter::setReportNamespaceDeclarations | ( | boolean | declareNamespaces | ) | [inline] |
This will define whether attribute namespace declarations shall be reported as "xmlns" attributes. This flag defaults to false
and behaves as the "namespace-prefixes" SAX core feature.
declareNamespaces | whether attribute namespace declarations shall be reported as "xmlns" attributes. |
void org::jdom::output::SAXOutputter::setReportDTDEvents | ( | boolean | reportDtdEvents | ) | [inline] |
This will define whether to report DTD events to SAX DeclHandlers and LexicalHandlers if these handlers are registered and the document to output includes a DocType declaration.
reportDtdEvents | whether to notify DTD events. |
void org::jdom::output::SAXOutputter::setFeature | ( | String | name, | |
boolean | value | |||
) | throws SAXNotRecognizedException, SAXNotSupportedException [inline] |
This will set the state of a SAX feature.
All XMLReaders are required to support setting to true and to false.
SAXOutputter currently supports the following SAX core features:
http://xml.org/sax/features/namespaces
true
indicates namespace URIs and unprefixed local names for element and attribute names will be available access: read/write, but always true
! http://xml.org/sax/features/namespace-prefixes
true
indicates XML 1.0 names (with prefixes) and attributes (including xmlns* attributes) will be available access: read/write http://xml.org/sax/features/validation
true
, the DocType internal subset will be parsed to fire DTD events access: read/write, defaults to true
name | String the feature name, which is a fully-qualified URI. | |
value | boolean the requested state of the feature (true or false). |
SAXNotRecognizedException | when SAXOutputter does not recognize the feature name. | |
SAXNotSupportedException | when SAXOutputter recognizes the feature name but cannot set the requested value. |
boolean org::jdom::output::SAXOutputter::getFeature | ( | String | name | ) | throws SAXNotRecognizedException, SAXNotSupportedException [inline] |
This will look up the value of a SAX feature.
name | String the feature name, which is a fully-qualified URI. |
boolean
the current state of the feature (true or false).SAXNotRecognizedException | when SAXOutputter does not recognize the feature name. | |
SAXNotSupportedException | when SAXOutputter recognizes the feature name but determine its value at this time. |
void org::jdom::output::SAXOutputter::setProperty | ( | String | name, | |
Object | value | |||
) | throws SAXNotRecognizedException, SAXNotSupportedException [inline] |
This will set the value of a SAX property. This method is also the standard mechanism for setting extended handlers.
SAXOutputter currently supports the following SAX properties:
http://xml.org/sax/properties/lexical-handler
org.xml.sax.ext.LexicalHandler
description: An optional extension handler for lexical events like comments. access: read/write http://xml.org/sax/properties/declaration-handler
org.xml.sax.ext.DeclHandler
description: An optional extension handler for DTD-related events other than notations and unparsed entities. access: read/write
name | String the property name, which is a fully-qualified URI. | |
value | Object the requested value for the property. |
SAXNotRecognizedException | when SAXOutputter does not recognize the property name. | |
SAXNotSupportedException | when SAXOutputter recognizes the property name but cannot set the requested value. |
Object org::jdom::output::SAXOutputter::getProperty | ( | String | name | ) | throws SAXNotRecognizedException, SAXNotSupportedException [inline] |
This will look up the value of a SAX property.
name | String the property name, which is a fully-qualified URI. |
Object
the current value of the property.SAXNotRecognizedException | when SAXOutputter does not recognize the property name. | |
SAXNotSupportedException | when SAXOutputter recognizes the property name but cannot determine its value at this time. |
void org::jdom::output::SAXOutputter::output | ( | Document | document | ) | throws JDOMException [inline] |
This will output the JDOM Document
, firing off the SAX events that have been registered.
document | JDOM Document to output. |
JDOMException | if any error occurred. |
void org::jdom::output::SAXOutputter::output | ( | List | nodes | ) | throws JDOMException [inline] |
This will output a list of JDOM nodes, firing off the SAX events that have been registered.
Warning: This method outputs ill-formed XML documents and should only be used to output document portions towards processors (such as XSLT processors) capable of accepting such ill-formed documents.
nodes | List of JDOM nodes to output. |
JDOMException | if any error occurred. |
void org::jdom::output::SAXOutputter::handleError | ( | JDOMException | exception | ) | throws JDOMException [inline, protected] |
Notifies the registered SAX error handler (if any) of an input processing error. The error handler can choose to absorb the error and let the processing continue.
exception | JDOMException containing the error information; will be wrapped in a SAXParseException when reported to the SAX error handler. |
JDOMException | if no error handler has been registered or if the error handler fired a SAXException. |
XMLReader org::jdom::output::SAXOutputter::createParser | ( | ) | throws Exception [inline, protected] |
Creates a SAX XMLReader.
XMLReader
a SAX2 parser.Exception | if no parser can be created. |
JDOMLocator org::jdom::output::SAXOutputter::getLocator | ( | ) | [inline] |
Returns a JDOMLocator object referencing the node currently being processed by this outputter. The returned object is a snapshot of the location information and can thus safely be memorized for later use.
This method allows direct access to the location information maintained by SAXOutputter without requiring to implement XMLFilter
. (In SAX, locators are only available though the ContentHandler
interface).
Note that location information is only available while SAXOutputter is outputting nodes. Hence this method should only be used by objects taking part in the output processing such as ErrorHandler
s.
null
if no output operation is being performed.