Most ContentHandler callbacks are supported. Both
ignorableWhitespace() and skippedEntity() have not
been implemented. The class returned by
JDOMLocator exposes the current node being operated
upon.
getLocator
At this time, it is not possible to access notations and unparsed entity
references in a DTD from JDOM. 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 and at this
point the document exists in memory and is known to have no errors.
| Modifier and Type | Field and Description |
|---|---|
| private static final String[] | attrTypeToNameMap
Array to map JDOM attribute type (as entry index) to SAX attribute type names. |
| private ContentHandler | contentHandler
registered |
| private static final String | |
| private static final String | DECL_HANDLER_ALT_PROPERTY
Shortcut for SAX-ext. |
| private static final String | DECL_HANDLER_SAX_PROPERTY
Shortcut for SAX-ext. |
| private boolean | declareNamespaces
Whether to report attribute namespace declarations as xmlns attributes. |
| private DeclHandler | declHandler
registered |
| private DTDHandler | dtdHandler
registered |
| private EntityResolver | entityResolver
registered |
| private ErrorHandler | errorHandler
registered |
| private static final String | LEXICAL_HANDLER_ALT_PROPERTY
Shortcut for SAX-ext. |
| private static final String | LEXICAL_HANDLER_SAX_PROPERTY
Shortcut for SAX-ext. |
| private LexicalHandler | lexicalHandler
registered |
| private JDOMLocator | locator
A SAX Locator that points at the JDOM node currently being outputted. |
| private static final String | NAMESPACES_SAX_FEATURE
Shortcut for SAX namespaces core feature |
| private static final String | NS_PREFIXES_SAX_FEATURE
Shortcut for SAX namespace-prefixes core feature |
| private boolean | reportDtdEvents
Whether to report DTD events to DeclHandlers and LexicalHandlers. |
| private static final String | VALIDATION_SAX_FEATURE
Shortcut for SAX validation core feature |
| Access | Constructor and Description |
|---|---|
| public | |
| public | SAXOutputter(ContentHandler
contains contentHandler)ContentHandler
callback methodsThis will create a |
| public | SAXOutputter(ContentHandler
contains contentHandler, ErrorHandler ContentHandler
callback methodscontains errorHandler, DTDHandler ErrorHandler callback methodscontains dtdHandler, EntityResolver DTDHandler callback methodscontains entityResolver)EntityResolver
callback methodsThis will create a |
| public | SAXOutputter(ContentHandler
contains contentHandler, ErrorHandler ContentHandler
callback methodscontains errorHandler, DTDHandler ErrorHandler callback methodscontains dtdHandler, EntityResolver DTDHandler callback methodscontains entityResolver, LexicalHandler EntityResolver
callback methodscontains lexicalHandler)LexicalHandler callbacks.This will create a |
| Modifier and Type | Method and Description |
|---|---|
| private AttributesImpl | Returns: AttributeImpl the updated attribute list.AttributeImpl where to add the attribute.Namespace the namespace to declare.Appends a namespace declaration in the form of a xmlns attribute to an attribute list, crerating this latter if needed. |
| private void | |
| private void | characters(String
all text in an element, including whitespace. elementText)This will be called for each chunk of character data encountered. |
| private void | |
| private XMLReader | Returns: XMLReader a SAX2 parser.This will create a SAX XMLReader capable of parsing a DTD and configure it so that the DTD parsing events are routed to the handlers registered onto this SAXOutputter. |
| protected XMLReader | |
| private void | documentLocator(Document
JDOM document)Document.This method tells you the line of the XML file being parsed. |
| private void | |
| private void | element(Element
Element used in callbacks.List stack of Namespaces in scope.This will recursively invoke all of the callbacks for a particular element. |
| private void | elementContent(List<E>
element content as a content, NamespaceStack List of nodes.List stack of Namespaces in scope.This will invoke the callbacks for the content of an element. |
| private void | elementContent(Content
a node, NamespaceStack Content node.List stack of Namespaces in scope.This will invoke the callbacks for the content of an element. |
| private void | |
| private void | endElement(Element
Element used in callbacks.
This will invoke the |
| private void | endPrefixMapping(NamespaceStack
List stack of Namespaces in scope.number of previously declared
namespaces previouslyDeclaredNamespaces)
This will invoke the |
| private void | |
| private static String | Returns: String the SAX 2.0 attribute type string.int the type of the JDOM attribute.Returns the SAX 2.0 attribute type string from the type of a JDOM Attribute. |
| public ContentHandler | Returns: the currentContentHandler or
null if none was registered.Returns the registered |
| public DeclHandler | Returns: the currentDeclHandler or
null if none was registered.Return the registered |
| public DTDHandler | Returns: the currentDTDHandler or
null if none was registered.Return the registered |
| public EntityResolver | Returns: the currentEntityResolver or
null if none was registered.Return the registered |
| public ErrorHandler | Returns: the currentErrorHandler or
null if none was registered.Return the registered |
| public boolean | Returns: boolean the current state of the feature
(true or false).String the feature name, which is a
fully-qualified URI.This will look up the value of a SAX feature. |
| public LexicalHandler | Returns: the currentLexicalHandler or
null if none was registered.Return the registered |
| public JDOMLocator | Returns: a JDOMLocator object referencing the node currently being processed ornull if no output
operation is being performed.Returns a JDOMLocator object referencing the node currently being processed by this outputter. |
| public Object | Returns: Object the current value of the property.String the property name, which is a
fully-qualified URI.This will look up the value of a SAX property. |
| public boolean | Returns: whether DTD events will be reportedReturns whether DTD events will be reported. |
| public boolean | Returns: whether attribute namespace declarations shall be reported as "xmlns" attributes.Returns whether attribute namespace declarations shall be reported as "xmlns" attributes. |
| private void | handleError(JDOMException
JDOMException containing the
error information; will be wrapped in a
SAXParseException when reported to
the SAX error handler.
Notifies the registered |
| public void | |
| public void | |
| public void | |
| public void | outputFragment(List<E>
List of JDOM nodes to output.This will output a list of JDOM nodes as a fragment of an XML document, firing off the SAX events that have been registered. |
| public void | outputFragment(Content
the node)Content node to output.This will output a single JDOM nodes as a fragment of an XML document, firing off the SAX events that have been registered. |
| private void | processingInstruction(ProcessingInstruction
ProcessingInstruction containing target and data.
This will invoke the |
| public void | setContentHandler(ContentHandler
contains contentHandler)ContentHandler
callback methods.This will set the |
| public void | setDeclHandler(DeclHandler
contains declaration callback methods. declHandler)This will set the |
| public void | setDTDHandler(DTDHandler
contains dtdHandler)DTDHandler callback methods.This will set the |
| public void | setEntityResolver(EntityResolver
contains EntityResolver callback methods. entityResolver)This will set the |
| public void | setErrorHandler(ErrorHandler
contains errorHandler)ErrorHandler callback methods.This will set the |
| public void | setFeature(String
String the feature name, which is a
fully-qualified URI.boolean the requested state of the
feature (true or false).This will set the state of a SAX feature. |
| public void | setLexicalHandler(LexicalHandler
contains lexical callback methods. lexicalHandler)This will set the |
| public void | setProperty(String
String the property name, which is a
fully-qualified URI.Object the requested value for the property.This will set the value of a SAX property. |
| public void | setReportDTDEvents(boolean
whether to notify DTD events. reportDtdEvents)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. |
| public void | setReportNamespaceDeclarations(boolean
whether attribute namespace declarations
shall be reported as "xmlns" attributes. declareNamespaces)This will define whether attribute namespace declarations shall be reported as "xmlns" attributes. |
| private void | startDocument()
This method is always the second method of all callbacks in all handlers to be invoked (setDocumentLocator is always first). |
| private void | startElement(Element
Element used in callbacks.List of namespaces to declare with
the element or null.
This will invoke the |
| private Attributes | Returns: Attributes declaring the namespaces local to
element or null.Element used in callbacks.List stack of Namespaces in scope.
This will invoke the |
| attrTypeToNameMap | back to summary |
|---|---|
| private static final String[] attrTypeToNameMap Array to map JDOM attribute type (as entry index) to SAX attribute type names. | |
| contentHandler | back to summary |
|---|---|
| private ContentHandler contentHandler registered | |
| CVS_ID | back to summary |
|---|---|
| private static final String CVS_ID | |
| DECL_HANDLER_ALT_PROPERTY | back to summary |
|---|---|
| private static final String DECL_HANDLER_ALT_PROPERTY Shortcut for SAX-ext. declaration handler alternate property | |
| DECL_HANDLER_SAX_PROPERTY | back to summary |
|---|---|
| private static final String DECL_HANDLER_SAX_PROPERTY Shortcut for SAX-ext. declaration handler property | |
| declareNamespaces | back to summary |
|---|---|
| private boolean declareNamespaces Whether to report attribute namespace declarations as xmlns attributes.
Defaults to
| |
| declHandler | back to summary |
|---|---|
| private DeclHandler declHandler registered | |
| dtdHandler | back to summary |
|---|---|
| private DTDHandler dtdHandler registered | |
| entityResolver | back to summary |
|---|---|
| private EntityResolver entityResolver registered | |
| errorHandler | back to summary |
|---|---|
| private ErrorHandler errorHandler registered | |
| LEXICAL_HANDLER_ALT_PROPERTY | back to summary |
|---|---|
| private static final String LEXICAL_HANDLER_ALT_PROPERTY Shortcut for SAX-ext. lexical handler alternate property. Although this property URI is not the one defined by the SAX "standard", some parsers use it instead of the official one. | |
| LEXICAL_HANDLER_SAX_PROPERTY | back to summary |
|---|---|
| private static final String LEXICAL_HANDLER_SAX_PROPERTY Shortcut for SAX-ext. lexical handler property | |
| lexicalHandler | back to summary |
|---|---|
| private LexicalHandler lexicalHandler registered | |
| locator | back to summary |
|---|---|
| private JDOMLocator locator A SAX Locator that points at the JDOM node currently being outputted. | |
| NAMESPACES_SAX_FEATURE | back to summary |
|---|---|
| private static final String NAMESPACES_SAX_FEATURE Shortcut for SAX namespaces core feature | |
| NS_PREFIXES_SAX_FEATURE | back to summary |
|---|---|
| private static final String NS_PREFIXES_SAX_FEATURE Shortcut for SAX namespace-prefixes core feature | |
| reportDtdEvents | back to summary |
|---|---|
| private boolean reportDtdEvents Whether to report DTD events to DeclHandlers and LexicalHandlers.
Defaults to | |
| VALIDATION_SAX_FEATURE | back to summary |
|---|---|
| private static final String VALIDATION_SAX_FEATURE Shortcut for SAX validation core feature | |
| SAXOutputter | back to summary |
|---|---|
| public SAXOutputter() This will create a | |
| SAXOutputter | back to summary |
|---|---|
| public SAXOutputter(ContentHandler contentHandler) This will create a
| |
| SAXOutputter | back to summary |
|---|---|
| public SAXOutputter(ContentHandler contentHandler, ErrorHandler errorHandler, DTDHandler dtdHandler, EntityResolver entityResolver) This will create a
| |
| SAXOutputter | back to summary |
|---|---|
| public SAXOutputter(ContentHandler contentHandler, ErrorHandler errorHandler, DTDHandler dtdHandler, EntityResolver entityResolver, LexicalHandler lexicalHandler) This will create a
| |
| addNsAttribute | back to summary |
|---|---|
| private AttributesImpl addNsAttribute(AttributesImpl atts, Namespace ns) Appends a namespace declaration in the form of a xmlns attribute to an attribute list, crerating this latter if needed.
| |
| cdata | back to summary |
|---|---|
| private void cdata(String cdataText) throws JDOMException This will be called for each chunk of CDATA section encountered.
| |
| characters | back to summary |
|---|---|
| private void characters(String elementText) throws JDOMException This will be called for each chunk of character data encountered.
| |
| comment | back to summary |
|---|---|
| private void comment(String commentText) throws JDOMException This will be called for each chunk of comment data encontered.
| |
| createDTDParser | back to summary |
|---|---|
| private XMLReader createDTDParser() throws JDOMException This will create a SAX XMLReader capable of parsing a DTD and configure it so that the DTD parsing events are routed to the handlers registered onto this SAXOutputter.
| |
| createParser | back to summary |
|---|---|
| protected XMLReader createParser() throws Exception Creates a SAX XMLReader. | |
| documentLocator | back to summary |
|---|---|
| private void documentLocator(Document document) This method tells you the line of the XML file being parsed. For an in-memory document, it's meaningless. The location is only valid for the current parsing lifecycle, but the document has already been parsed. Therefore, it returns -1 for both line and column numbers.
| |
| dtdEvents | back to summary |
|---|---|
| private void dtdEvents(Document document) throws JDOMException This parses a DTD declaration to fire the related events towards the registered handlers.
| |
| element | back to summary |
|---|---|
| private void element(Element element, NamespaceStack namespaces) throws JDOMException This will recursively invoke all of the callbacks for a particular element.
| |
| elementContent | back to summary |
|---|---|
| private void elementContent(List<E> content, NamespaceStack namespaces) throws JDOMException This will invoke the callbacks for the content of an element.
| |
| elementContent | back to summary |
|---|---|
| private void elementContent(Content node, NamespaceStack namespaces) throws JDOMException This will invoke the callbacks for the content of an element.
| |
| endDocument | back to summary |
|---|---|
| private void endDocument() throws JDOMException Always the last method of all callbacks in all handlers to be invoked. | |
| endElement | back to summary |
|---|---|
| private void endElement(Element element) throws JDOMException
This will invoke the
| |
| endPrefixMapping | back to summary |
|---|---|
| private void endPrefixMapping(NamespaceStack namespaces, int previouslyDeclaredNamespaces) throws JDOMException
This will invoke the
| |
| entityRef | back to summary |
|---|---|
| private void entityRef(EntityRef entity) throws JDOMException
This will invoke the
| |
| getAttributeTypeName | back to summary |
|---|---|
| private static String getAttributeTypeName(int type) Returns the SAX 2.0 attribute type string from the type of a JDOM Attribute.
| |
| getContentHandler | back to summary |
|---|---|
| public ContentHandler getContentHandler() Returns the registered
| |
| getDeclHandler | back to summary |
|---|---|
| public DeclHandler getDeclHandler() Return the registered
| |
| getDTDHandler | back to summary |
|---|---|
| public DTDHandler getDTDHandler() Return the registered
| |
| getEntityResolver | back to summary |
|---|---|
| public EntityResolver getEntityResolver() Return the registered
| |
| getErrorHandler | back to summary |
|---|---|
| public ErrorHandler getErrorHandler() Return the registered
| |
| getFeature | back to summary |
|---|---|
| public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException This will look up the value of a SAX feature.
| |
| getLexicalHandler | back to summary |
|---|---|
| public LexicalHandler getLexicalHandler() Return the registered
| |
| getLocator | back to summary |
|---|---|
| public JDOMLocator getLocator() 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
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
| |
| getProperty | back to summary |
|---|---|
| public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException This will look up the value of a SAX property.
| |
| getReportDTDEvents | back to summary |
|---|---|
| public boolean getReportDTDEvents() Returns whether DTD events will be reported.
| |
| getReportNamespaceDeclarations | back to summary |
|---|---|
| public boolean getReportNamespaceDeclarations() Returns whether attribute namespace declarations shall be reported as "xmlns" attributes.
| |
| handleError | back to summary |
|---|---|
| private void handleError(JDOMException exception) throws JDOMException
Notifies the registered
| |
| output | back to summary |
|---|---|
| public void output(Document document) throws JDOMException This will output the
| |
| output | back to summary |
|---|---|
| public void output(List<E> nodes) throws JDOMException This will output a list of JDOM nodes as a document, firing off the SAX events that have been registered. Warning This method may output ill-formed XML documents if the list contains top-level objects that are not legal at the document level (e.g. Text or CDATA nodes, multiple Element nodes, etc.). Thus, it should only be used to output document portions towards ContentHandlers capable of accepting such ill-formed documents (such as XSLT processors).
| |
| output | back to summary |
|---|---|
| public void output(Element node) throws JDOMException This will output a single JDOM element as a document, firing off the SAX events that have been registered.
| |
| outputFragment | back to summary |
|---|---|
| public void outputFragment(List<E> nodes) throws JDOMException This will output a list of JDOM nodes as a fragment of an XML document, firing off the SAX events that have been registered. Warning This method does not call the
| |
| outputFragment | back to summary |
|---|---|
| public void outputFragment(Content node) throws JDOMException This will output a single JDOM nodes as a fragment of an XML document, firing off the SAX events that have been registered. Warning This method does not call the
| |
| processingInstruction | back to summary |
|---|---|
| private void processingInstruction(ProcessingInstruction pi) throws JDOMException
This will invoke the
| |
| setContentHandler | back to summary |
|---|---|
| public void setContentHandler(ContentHandler contentHandler) This will set the
| |
| setDeclHandler | back to summary |
|---|---|
| public void setDeclHandler(DeclHandler declHandler) This will set the
| |
| setDTDHandler | back to summary |
|---|---|
| public void setDTDHandler(DTDHandler dtdHandler) This will set the
| |
| setEntityResolver | back to summary |
|---|---|
| public void setEntityResolver(EntityResolver entityResolver) This will set the
| |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ErrorHandler errorHandler) This will set the
| |
| setFeature | back to summary |
|---|---|
| public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException 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:
| |
| setLexicalHandler | back to summary |
|---|---|
| public void setLexicalHandler(LexicalHandler lexicalHandler) This will set the
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException 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:
| |
| setReportDTDEvents | back to summary |
|---|---|
| public void setReportDTDEvents(boolean reportDtdEvents) 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.
| |
| setReportNamespaceDeclarations | back to summary |
|---|---|
| public void setReportNamespaceDeclarations(boolean declareNamespaces) This will define whether attribute namespace declarations shall be
reported as "xmlns" attributes. This flag defaults to
| |
| startDocument | back to summary |
|---|---|
| private void startDocument() throws JDOMException This method is always the second method of all callbacks in all handlers to be invoked (setDocumentLocator is always first). | |
| startElement | back to summary |
|---|---|
| private void startElement(Element element, Attributes nsAtts) throws JDOMException
This will invoke the
| |
| startPrefixMapping | back to summary |
|---|---|
| private Attributes startPrefixMapping(Element element, NamespaceStack namespaces) throws JDOMException
This will invoke the
| |