|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.dom4j.io.SAXWriter
SAXWriter writes a DOM4J tree to a SAX ContentHandler.
| Field Summary | |
protected static String |
FEATURE_NAMESPACE_PREFIXES
|
protected static String |
FEATURE_NAMESPACES
|
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 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(InputSource input)
Parses an XML document. |
void |
parse(String systemId)
This method is not supported. |
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(CDATA cdata)
Generates SAX events for the given CDATA |
void |
write(Comment comment)
Generates SAX events for the given Comment |
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 |
protected void |
write(Element element,
NamespaceStack namespaceStack)
|
void |
write(Entity entity)
Generates SAX events for the given Entity |
void |
write(Node node)
A polymorphic method to write any Node to this SAX stream |
void |
write(ProcessingInstruction pi)
Generates SAX events for the given ProcessingInstruction |
void |
write(String text)
Generates SAX events for the given text |
void |
writeClose(Element element)
Writes the closing tag of an Element
|
protected void |
writeContent(Branch branch,
NamespaceStack namespaceStack)
|
void |
writeOpen(Element element)
Writes the opening tag of an Element, including its Attributes but without its content.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final String[] LEXICAL_HANDLER_NAMES
protected static final String FEATURE_NAMESPACE_PREFIXES
protected static final String FEATURE_NAMESPACES
| Constructor Detail |
public SAXWriter()
public SAXWriter(ContentHandler contentHandler)
public SAXWriter(ContentHandler contentHandler,
LexicalHandler lexicalHandler)
public SAXWriter(ContentHandler contentHandler,
LexicalHandler lexicalHandler,
EntityResolver entityResolver)
| Method Detail |
public void write(Node node)
throws SAXException
node - DOCUMENT ME!
SAXException - DOCUMENT ME!
public void write(Document document)
throws SAXException
document - is the Document to parse
SAXException - if there is a SAX error processing the events
public void write(Element element)
throws SAXException
element - is the Element to parse
SAXException - if there is a SAX error processing the events
public void writeOpen(Element element)
throws SAXException
Writes the opening tag of an Element, including its Attributes but without its content.
element - Element to output.
SAXException - DOCUMENT ME!
public void writeClose(Element element)
throws SAXException
Writes the closing tag of an Element
element - Element to output.
SAXException - DOCUMENT ME!
public void write(String text)
throws SAXException
text - is the text to send to the SAX ContentHandler
SAXException - if there is a SAX error processing the events
public void write(CDATA cdata)
throws SAXException
cdata - is the CDATA to parse
SAXException - if there is a SAX error processing the events
public void write(Comment comment)
throws SAXException
comment - is the Comment to parse
SAXException - if there is a SAX error processing the events
public void write(Entity entity)
throws SAXException
entity - is the Entity to parse
SAXException - if there is a SAX error processing the events
public void write(ProcessingInstruction pi)
throws SAXException
pi - is the ProcessingInstruction to parse
SAXException - if there is a SAX error processing the eventspublic boolean isDeclareNamespaceAttributes()
false as per the SAX specification.
This property is set via the SAX feature
"http://xml.org/sax/features/namespace-prefixes"
public void setDeclareNamespaceAttributes(boolean declareNamespaceAttrs)
declareNamespaceAttrs - DOCUMENT ME!public ContentHandler getContentHandler()
getContentHandler in interface XMLReaderContentHandler called when SAX events are
raisedpublic void setContentHandler(ContentHandler contentHandler)
ContentHandler called when SAX events are raised
setContentHandler in interface XMLReadercontentHandler - is the ContentHandler called when SAX events
are raisedpublic DTDHandler getDTDHandler()
getDTDHandler in interface XMLReaderDTDHandlerpublic void setDTDHandler(DTDHandler handler)
DTDHandler.
setDTDHandler in interface XMLReaderhandler - DOCUMENT ME!public ErrorHandler getErrorHandler()
getErrorHandler in interface XMLReaderErrorHandlerpublic void setErrorHandler(ErrorHandler errorHandler)
ErrorHandler.
setErrorHandler in interface XMLReadererrorHandler - DOCUMENT ME!public EntityResolver getEntityResolver()
getEntityResolver in interface XMLReaderEntityResolver used when a Document contains a
DTDpublic void setEntityResolver(EntityResolver entityResolver)
EntityResolver.
setEntityResolver in interface XMLReaderentityResolver - is the EntityResolverpublic LexicalHandler getLexicalHandler()
LexicalHandler used when a Document contains a
DTDpublic void setLexicalHandler(LexicalHandler lexicalHandler)
LexicalHandler.
lexicalHandler - is the LexicalHandlerpublic void setXMLReader(XMLReader xmlReader)
XMLReader used to write SAX events to
xmlReader - is the XMLReader
public boolean getFeature(String name)
throws SAXNotRecognizedException,
SAXNotSupportedException
getFeature in interface XMLReadername - DOCUMENT ME!
SAXNotRecognizedException - DOCUMENT ME!
SAXNotSupportedException - DOCUMENT ME!
public void setFeature(String name,
boolean value)
throws SAXNotRecognizedException,
SAXNotSupportedException
setFeature in interface XMLReadername - DOCUMENT ME!value - DOCUMENT ME!
SAXNotRecognizedException - DOCUMENT ME!
SAXNotSupportedException - DOCUMENT ME!
public void setProperty(String name,
Object value)
setProperty in interface XMLReadername - DOCUMENT ME!value - DOCUMENT ME!
public Object getProperty(String name)
throws SAXNotRecognizedException,
SAXNotSupportedException
getProperty in interface XMLReadername - DOCUMENT ME!
SAXNotRecognizedException - DOCUMENT ME!
SAXNotSupportedException - DOCUMENT ME!
public void parse(String systemId)
throws SAXNotSupportedException
parse in interface XMLReadersystemId - DOCUMENT ME!
SAXNotSupportedException - DOCUMENT ME!
public void parse(InputSource input)
throws SAXException
SAXNotSupportedExceptionexception is thrown.
parse in interface XMLReaderinput - DOCUMENT ME!
SAXException - DOCUMENT ME!
SAXNotSupportedException - if the input source is not wrapping a dom4j document
protected void writeContent(Branch branch,
NamespaceStack namespaceStack)
throws SAXException
SAXException
protected void documentLocator(Document document)
throws SAXException
Locatoris only really useful when parsing a
textual document as its main purpose is to identify the line and column
number. Since we are processing an in memory tree which will probably
have its line number information removed, we'll just use -1 for the line
and column numbers.
document - DOCUMENT ME!
SAXException - DOCUMENT ME!
protected void entityResolver(Document document)
throws SAXException
SAXException
protected void dtdHandler(Document document)
throws SAXException
document - DOCUMENT ME!
SAXException - DOCUMENT ME!
protected void startDocument()
throws SAXException
SAXException
protected void endDocument()
throws SAXException
SAXException
protected void write(Element element,
NamespaceStack namespaceStack)
throws SAXException
SAXException
protected AttributesImpl startPrefixMapping(Element element,
NamespaceStack namespaceStack)
throws SAXException
element - DOCUMENT ME!namespaceStack - DOCUMENT ME!
SAXException - DOCUMENT ME!
protected void endPrefixMapping(NamespaceStack stack,
int stackSize)
throws SAXException
stack - DOCUMENT ME!stackSize - DOCUMENT ME!
SAXException - DOCUMENT ME!
protected void startElement(Element element,
AttributesImpl namespaceAttributes)
throws SAXException
SAXException
protected void endElement(Element element)
throws SAXException
SAXException
protected Attributes createAttributes(Element element,
Attributes namespaceAttributes)
throws SAXException
SAXException
protected AttributesImpl addNamespaceAttribute(AttributesImpl attrs,
Namespace namespace)
attrs - DOCUMENT ME!namespace - DOCUMENT ME!
protected boolean isIgnoreableNamespace(Namespace namespace,
NamespaceStack namespaceStack)
namespace - DOCUMENT ME!namespaceStack - DOCUMENT ME!
protected void checkForNullHandlers()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||