org.dom4j.io
public class SAXWriter extends Object implements XMLReader
SAXWriter writes a DOM4J tree to a SAX ContentHandler.
Version: $Revision: 1.24 $
| Field Summary | |
|---|---|
| protected static String | FEATURE_NAMESPACES |
| protected static String | FEATURE_NAMESPACE_PREFIXES |
| protected static String[] | LEXICAL_HANDLER_NAMES |
| Constructor Summary | |
|---|---|
| SAXWriter() | |
| SAXWriter(ContentHandler contentHandler) | |
| SAXWriter(ContentHandler contentHandler, LexicalHandler lexicalHandler) | |
| SAXWriter(ContentHandler contentHandler, LexicalHandler lexicalHandler, EntityResolver entityResolver) | |
| Method Summary | |
|---|---|
| protected AttributesImpl | addNamespaceAttribute(AttributesImpl attrs, Namespace namespace)
If isDelcareNamespaceAttributes() is enabled then this method will add
the given namespace declaration to the supplied attributes object,
creating one if it does not exist.
|
| protected void | checkForNullHandlers()
Ensures non-null content handlers? |
| protected Attributes | createAttributes(Element element, Attributes namespaceAttributes) |
| protected void | documentLocator(Document document)
The org.xml.sax.Locatoris only really useful when parsing a
textual document as its main purpose is to identify the line and column
number. |
| protected void | dtdHandler(Document document)
We do not yet support DTD or XML Schemas so this method does nothing
right now.
|
| protected void | endDocument() |
| protected void | endElement(Element element) |
| protected void | endPrefixMapping(NamespaceStack stack, int stackSize)
Fires a SAX endPrefixMapping event for all the namespaceStack which have
gone out of scope
|
| protected void | entityResolver(Document document) |
| ContentHandler | getContentHandler()
DOCUMENT ME!
|
| DTDHandler | getDTDHandler()
DOCUMENT ME!
|
| EntityResolver | getEntityResolver()
DOCUMENT ME!
|
| ErrorHandler | getErrorHandler()
DOCUMENT ME!
|
| boolean | getFeature(String name)
Looks up the value of a feature.
|
| LexicalHandler | getLexicalHandler()
DOCUMENT ME!
|
| Object | getProperty(String name)
Gets the given SAX property
|
| boolean | isDeclareNamespaceAttributes()
Should namespace declarations be converted to "xmlns" attributes. |
| protected boolean | isIgnoreableNamespace(Namespace namespace, NamespaceStack namespaceStack)
DOCUMENT ME!
|
| void | parse(String systemId)
This method is not supported.
|
| void | parse(InputSource input)
Parses an XML document. |
| void | setContentHandler(ContentHandler contentHandler)
Sets the ContentHandler called when SAX events are raised
|
| void | setDeclareNamespaceAttributes(boolean declareNamespaceAttrs)
Sets whether namespace declarations should be exported as "xmlns"
attributes or not. |
| void | setDTDHandler(DTDHandler handler)
Sets the DTDHandler.
|
| void | setEntityResolver(EntityResolver entityResolver)
Sets the EntityResolver.
|
| void | setErrorHandler(ErrorHandler errorHandler)
Sets the ErrorHandler.
|
| void | setFeature(String name, boolean value)
This implementation does actually use any features but just stores them
for later retrieval
|
| void | setLexicalHandler(LexicalHandler lexicalHandler)
Sets the LexicalHandler.
|
| void | setProperty(String name, Object value)
Sets the given SAX property
|
| void | setXMLReader(XMLReader xmlReader)
Sets the XMLReader used to write SAX events to
|
| protected void | startDocument() |
| protected void | startElement(Element element, AttributesImpl namespaceAttributes) |
| protected AttributesImpl | startPrefixMapping(Element element, NamespaceStack namespaceStack)
Fires a SAX startPrefixMapping event for all the namespaceStack which
have just come into scope
|
| void | write(Node node)
A polymorphic method to write any Node to this SAX stream
|
| void | write(Document document)
Generates SAX events for the given Document and all its content
|
| void | write(Element element)
Generates SAX events for the given Element and all its content
|
| void | write(String text)
Generates SAX events for the given text
|
| void | write(CDATA cdata)
Generates SAX events for the given CDATA
|
| void | write(Comment comment)
Generates SAX events for the given Comment
|
| void | write(Entity entity)
Generates SAX events for the given Entity
|
| void | write(ProcessingInstruction pi)
Generates SAX events for the given ProcessingInstruction
|
| protected void | write(Element element, NamespaceStack namespaceStack) |
| void | writeClose(Element element) Writes the closing tag of an Element |
| protected void | writeContent(Branch branch, NamespaceStack namespaceStack) |
| void | writeOpen(Element element) |
Parameters: attrs DOCUMENT ME! namespace DOCUMENT ME!
Returns: DOCUMENT ME!
Parameters: document DOCUMENT ME!
Throws: SAXException DOCUMENT ME!
Parameters: document DOCUMENT ME!
Throws: SAXException DOCUMENT ME!
Parameters: stack DOCUMENT ME! stackSize DOCUMENT ME!
Throws: SAXException DOCUMENT ME!
Returns: the ContentHandler called when SAX events are
raised
Returns: the DTDHandler
Returns: the EntityResolver used when a Document contains a
DTD
Returns: the ErrorHandler
Parameters: name DOCUMENT ME!
Returns: DOCUMENT ME!
Throws: SAXNotRecognizedException DOCUMENT ME! SAXNotSupportedException DOCUMENT ME!
Returns: the LexicalHandler used when a Document contains a
DTD
Parameters: name DOCUMENT ME!
Returns: DOCUMENT ME!
Throws: SAXNotRecognizedException DOCUMENT ME! SAXNotSupportedException DOCUMENT ME!
false as per the SAX specification.
This property is set via the SAX feature
"http://xml.org/sax/features/namespace-prefixes"
Returns: DOCUMENT ME!
Parameters: namespace DOCUMENT ME! namespaceStack DOCUMENT ME!
Returns: true if the given namespace is an ignorable namespace (such as Namespace.NO_NAMESPACE or Namespace.XML_NAMESPACE) or if the namespace has already been declared in the current scope
Parameters: systemId DOCUMENT ME!
Throws: SAXNotSupportedException DOCUMENT ME!
Parameters: input DOCUMENT ME!
Throws: SAXException DOCUMENT ME! SAXNotSupportedException if the input source is not wrapping a dom4j document
ContentHandler called when SAX events are raised
Parameters: contentHandler
is the ContentHandler called when SAX events
are raised
Parameters: declareNamespaceAttrs DOCUMENT ME!
DTDHandler.
Parameters: handler DOCUMENT ME!
EntityResolver.
Parameters: entityResolver
is the EntityResolver
ErrorHandler.
Parameters: errorHandler DOCUMENT ME!
Parameters: name DOCUMENT ME! value DOCUMENT ME!
Throws: SAXNotRecognizedException DOCUMENT ME! SAXNotSupportedException DOCUMENT ME!
LexicalHandler.
Parameters: lexicalHandler
is the LexicalHandler
Parameters: name DOCUMENT ME! value DOCUMENT ME!
XMLReader used to write SAX events to
Parameters: xmlReader
is the XMLReader
Parameters: element DOCUMENT ME! namespaceStack DOCUMENT ME!
Returns: DOCUMENT ME!
Throws: SAXException DOCUMENT ME!
Parameters: node DOCUMENT ME!
Throws: SAXException DOCUMENT ME!
Parameters: document is the Document to parse
Throws: SAXException if there is a SAX error processing the events
Parameters: element is the Element to parse
Throws: SAXException if there is a SAX error processing the events
Parameters: text is the text to send to the SAX ContentHandler
Throws: SAXException if there is a SAX error processing the events
Parameters: cdata is the CDATA to parse
Throws: SAXException if there is a SAX error processing the events
Parameters: comment is the Comment to parse
Throws: SAXException if there is a SAX error processing the events
Parameters: entity is the Entity to parse
Throws: SAXException if there is a SAX error processing the events
Parameters: pi is the ProcessingInstruction to parse
Throws: SAXException if there is a SAX error processing the events
Writes the closing tag of an Element
Parameters: element
Element to output.
Throws: SAXException DOCUMENT ME!
Writes the opening tag of an Element, including its Attributes but without its content.
Parameters: element
Element to output.
Throws: SAXException DOCUMENT ME!