| java.lang.Object org.xml.sax.helpers.XMLFilterImpl org.jivesoftware.util.XMLWriter
All known Subclasses: org.jivesoftware.openfire.net.XMLSocketWriter,
XMLWriter | public class XMLWriter extends XMLFilterImpl implements LexicalHandler(Code) | | Replacement class of the original XMLWriter.java (version: 1.77) since the original is still
using StringBuffer which is not fast.
|
Method Summary | |
public void | characters(char[] ch, int start, int length) | public void | close() | public void | comment(char[] ch, int start, int length) | protected Writer | createWriter(OutputStream outStream, String encoding) Get an OutputStreamWriter, use preferred encoding. | protected int | defaultMaximumAllowedCharacter() Returns the maximum allowed character code that should be allowed
unescaped which defaults to 127 in US-ASCII (7 bit) or
255 in ISO-* (8 bit). | public void | endCDATA() | public void | endDTD() | public void | endDocument() | public void | endElement(String namespaceURI, String localName, String qName) | public void | endEntity(String name) | public void | endPrefixMapping(String prefix) | protected String | escapeAttributeEntities(String text) This will take the pre-defined entities in XML 1.0 and
convert their character representation to the appropriate
entity reference, suitable for XML attributes. | protected String | escapeElementEntities(String text) This will take the pre-defined entities in XML 1.0 and
convert their character representation to the appropriate
entity reference, suitable for XML attributes. | public void | flush() | public LexicalHandler | getLexicalHandler() | public int | getMaximumAllowedCharacter() Returns the maximum allowed character code that should be allowed
unescaped which defaults to 127 in US-ASCII (7 bit) or
255 in ISO-* (8 bit). | protected OutputFormat | getOutputFormat() Lets subclasses get at the current format object, so they can call setTrimText, setNewLines, etc. | public Object | getProperty(String name) | protected void | handleException(IOException e) | public void | ignorableWhitespace(char[] ch, int start, int length) | protected void | indent() | protected void | installLexicalHandler() | final protected boolean | isElementSpacePreserved(Element element) Determines if element is a special case of XML elements
where it contains an xml:space attribute of "preserve". | public boolean | isEscapeText() true if text thats output should be escaped.This is enabled by default. | protected boolean | isExpandEmptyElements() | protected boolean | isNamespaceDeclaration(Namespace ns) | public void | notationDecl(String name, String publicID, String systemID) | public void | parse(InputSource source) | public void | println() | public void | processingInstruction(String target, String data) | public boolean | resolveEntityRefs() | public void | setDocumentLocator(Locator locator) | public void | setEscapeText(boolean escapeText) Sets whether text output should be escaped or not.
This is enabled by default. | public void | setIndentLevel(int indentLevel) Set the initial indentation level. | public void | setLexicalHandler(LexicalHandler handler) | public void | setMaximumAllowedCharacter(int maximumAllowedCharacter) Sets the maximum allowed character code that should be allowed
unescaped
such as 127 in US-ASCII (7 bit) or 255 in ISO-* (8 bit)
or -1 to not escape any characters (other than the special XML characters like < > &)
If this is not explicitly set then it is defaulted from the encoding. | public void | setOutputStream(OutputStream out) | public void | setProperty(String name, Object value) | public void | setResolveEntityRefs(boolean resolve) | public void | setWriter(Writer writer) | protected boolean | shouldEncodeChar(char c) Should the given character be escaped. | public void | startCDATA() | public void | startDTD(String name, String publicID, String systemID) | public void | startDocument() | public void | startElement(String namespaceURI, String localName, String qName, Attributes attributes) | public void | startEntity(String name) | public void | startPrefixMapping(String prefix, String uri) | public void | unparsedEntityDecl(String name, String publicID, String systemID, String notationName) | public void | write(Attribute attribute) Writes the given
org.dom4j.Attribute . | public void | write(Document doc) This will print the Document to the current Writer.
Warning: using your own Writer may cause the writer's
preferred character encoding to be ignored. | public void | write(Element element) | public void | write(CDATA cdata) Writes the given
CDATA . | public void | write(Comment comment) Writes the given
Comment . | public void | write(DocumentType docType) Writes the given
DocumentType . | public void | write(Entity entity) Writes the given
Entity . | public void | write(Namespace namespace) Writes the given
Namespace . | public void | write(ProcessingInstruction processingInstruction) Writes the given
ProcessingInstruction . | public void | write(String text) | public void | write(Text text) Writes the given
Text . | public void | write(Node node) Writes the given
Node . | public void | write(Object object) Writes the given object which should be a String, a Node or a List
of Nodes. | protected void | writeAttribute(Attribute attribute) | protected void | writeAttribute(Attributes attributes, int index) | protected void | writeAttributes(Element element) | protected void | writeAttributes(Attributes attributes) | protected void | writeCDATA(String text) | public void | writeClose(Element element) | protected void | writeClose(String qualifiedName) | protected void | writeComment(String text) | protected void | writeDeclaration()
This will write the declaration to the given Writer. | protected void | writeDocType(DocumentType docType) | protected void | writeDocType(String name, String publicID, String systemID) | protected void | writeElement(Element element) | protected void | writeElementContent(Element element) Outputs the content of the given element. | protected void | writeEmptyElementClose(String qualifiedName) | protected void | writeEntity(Entity entity) | protected void | writeEntityRef(String name) | protected void | writeEscapeAttributeEntities(String text) | protected void | writeNamespace(Namespace namespace) | protected void | writeNamespace(String prefix, String uri) | protected void | writeNamespaces() | protected void | writeNode(Node node) | protected void | writeNodeText(Node node) This method is used to write out Nodes that contain text
and still allow for xml:space to be handled properly. | public void | writeOpen(Element element) | protected void | writePrintln() | protected void | writeProcessingInstruction(ProcessingInstruction processingInstruction) | protected void | writeString(String text) |
DEFAULT_FORMAT | final protected static OutputFormat DEFAULT_FORMAT(Code) | | |
LEXICAL_HANDLER_NAMES | final protected static String[] LEXICAL_HANDLER_NAMES(Code) | | |
lastOutputNodeType | protected int lastOutputNodeType(Code) | | Stores the last type of node written so algorithms can refer to the
previous node type
|
preserve | protected boolean preserve(Code) | | Stores the xml:space attribute value of preserve for whitespace flag
|
writer | protected Writer writer(Code) | | The Writer used to output to
|
XMLWriter | public XMLWriter(Writer writer, OutputFormat format)(Code) | | |
characters | public void characters(char[] ch, int start, int length) throws SAXException(Code) | | |
defaultMaximumAllowedCharacter | protected int defaultMaximumAllowedCharacter()(Code) | | Returns the maximum allowed character code that should be allowed
unescaped which defaults to 127 in US-ASCII (7 bit) or
255 in ISO-* (8 bit).
|
escapeAttributeEntities | protected String escapeAttributeEntities(String text)(Code) | | This will take the pre-defined entities in XML 1.0 and
convert their character representation to the appropriate
entity reference, suitable for XML attributes.
|
escapeElementEntities | protected String escapeElementEntities(String text)(Code) | | This will take the pre-defined entities in XML 1.0 and
convert their character representation to the appropriate
entity reference, suitable for XML attributes.
|
getMaximumAllowedCharacter | public int getMaximumAllowedCharacter()(Code) | | Returns the maximum allowed character code that should be allowed
unescaped which defaults to 127 in US-ASCII (7 bit) or
255 in ISO-* (8 bit).
|
getOutputFormat | protected OutputFormat getOutputFormat()(Code) | | Lets subclasses get at the current format object, so they can call setTrimText, setNewLines, etc.
Put in to support the HTMLWriter, in the way
that it pushes the current newline/trim state onto a stack and overrides
the state within preformatted tags.
|
ignorableWhitespace | public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException(Code) | | |
installLexicalHandler | protected void installLexicalHandler()(Code) | | |
isElementSpacePreserved | final protected boolean isElementSpacePreserved(Element element)(Code) | | Determines if element is a special case of XML elements
where it contains an xml:space attribute of "preserve".
If it does, then retain whitespace.
|
isEscapeText | public boolean isEscapeText()(Code) | | true if text thats output should be escaped.This is enabled by default. It could be disabled ifthe output format is textual, like in XSLT where we can havexml, html or text output. |
isExpandEmptyElements | protected boolean isExpandEmptyElements()(Code) | | |
isNamespaceDeclaration | protected boolean isNamespaceDeclaration(Namespace ns)(Code) | | |
println | public void println() throws IOException(Code) | | Writes the new line text to the underlying Writer
|
resolveEntityRefs | public boolean resolveEntityRefs()(Code) | | |
setDocumentLocator | public void setDocumentLocator(Locator locator)(Code) | | |
setEscapeText | public void setEscapeText(boolean escapeText)(Code) | | Sets whether text output should be escaped or not.
This is enabled by default. It could be disabled if
the output format is textual, like in XSLT where we can have
xml, html or text output.
|
setIndentLevel | public void setIndentLevel(int indentLevel)(Code) | | Set the initial indentation level. This can be used to output
a document (or, more likely, an element) starting at a given
indent level, so it's not always flush against the left margin.
Default: 0
Parameters: indentLevel - the number of indents to start with |
setMaximumAllowedCharacter | public void setMaximumAllowedCharacter(int maximumAllowedCharacter)(Code) | | Sets the maximum allowed character code that should be allowed
unescaped
such as 127 in US-ASCII (7 bit) or 255 in ISO-* (8 bit)
or -1 to not escape any characters (other than the special XML characters like < > &)
If this is not explicitly set then it is defaulted from the encoding.
Parameters: maximumAllowedCharacter - The maximumAllowedCharacter to set |
setResolveEntityRefs | public void setResolveEntityRefs(boolean resolve)(Code) | | |
shouldEncodeChar | protected boolean shouldEncodeChar(char c)(Code) | | Should the given character be escaped. This depends on the
encoding of the document.
boolean |
write | public void write(Attribute attribute) throws IOException(Code) | | Writes the given
org.dom4j.Attribute .
Parameters: attribute - Attribute to output. |
write | public void write(Document doc) throws IOException(Code) | | This will print the Document to the current Writer.
Warning: using your own Writer may cause the writer's
preferred character encoding to be ignored. If you use
encodings other than UTF8, we recommend using the method that
takes an OutputStream instead.
Note: as with all Writers, you may need to flush() yours
after this method returns.
Parameters: doc - Document to format. throws: IOException - - if there's any problem writing. |
write | public void write(Element element) throws IOException(Code) | | Writes the
org.dom4j.Element , including
its
Attribute s, and its value, and all
its content (child nodes) to the current Writer.
Parameters: element - Element to output. |
write | public void write(CDATA cdata) throws IOException(Code) | | Writes the given
CDATA .
Parameters: cdata - CDATA to output. |
write | public void write(Comment comment) throws IOException(Code) | | Writes the given
Comment .
Parameters: comment - Comment to output. |
write | public void write(DocumentType docType) throws IOException(Code) | | Writes the given
DocumentType .
Parameters: docType - DocumentType to output. |
write | public void write(Entity entity) throws IOException(Code) | | Writes the given
Entity .
Parameters: entity - Entity to output. |
write | public void write(Namespace namespace) throws IOException(Code) | | Writes the given
Namespace .
Parameters: namespace - Namespace to output. |
write | public void write(ProcessingInstruction processingInstruction) throws IOException(Code) | | Writes the given
ProcessingInstruction .
Parameters: processingInstruction - ProcessingInstruction to output. |
write | public void write(String text) throws IOException(Code) | | Print out a
String , Perfoms
the necessary entity escaping and whitespace stripping.
Parameters: text - is the text to output |
write | public void write(Text text) throws IOException(Code) | | Writes the given
Text .
Parameters: text - Text to output. |
write | public void write(Node node) throws IOException(Code) | | Writes the given
Node .
Parameters: node - Node to output. |
write | public void write(Object object) throws IOException(Code) | | Writes the given object which should be a String, a Node or a List
of Nodes.
Parameters: object - is the object to output. |
writeAttribute | protected void writeAttribute(Attribute attribute) throws IOException(Code) | | |
writeAttributes | protected void writeAttributes(Element element) throws IOException(Code) | | Writes the attributes of the given element
|
writeClose | public void writeClose(Element element) throws IOException(Code) | | Writes the closing tag of an
Element
Parameters: element - Element to output. |
writeDeclaration | protected void writeDeclaration() throws IOException(Code) | |
This will write the declaration to the given Writer.
Assumes XML version 1.0 since we don't directly know.
|
writeDocType | protected void writeDocType(DocumentType docType) throws IOException(Code) | | |
writeElementContent | protected void writeElementContent(Element element) throws IOException(Code) | | Outputs the content of the given element. If whitespace trimming is
enabled then all adjacent text nodes are appended together before
the whitespace trimming occurs to avoid problems with multiple
text nodes being created due to text content that spans parser buffers
in a SAX parser.
|
writeNamespace | protected void writeNamespace(Namespace namespace) throws IOException(Code) | | |
writeNamespaces | protected void writeNamespaces() throws IOException(Code) | | Writes the SAX namepsaces
|
writeNodeText | protected void writeNodeText(Node node) throws IOException(Code) | | This method is used to write out Nodes that contain text
and still allow for xml:space to be handled properly.
|
writeOpen | public void writeOpen(Element element) throws IOException(Code) | | Writes the opening tag of an
Element ,
including its
Attribute s
but without its content.
Parameters: element - Element to output. |
writePrintln | protected void writePrintln() throws IOException(Code) | |
This will print a new line only if the newlines flag was set to true
|
writeProcessingInstruction | protected void writeProcessingInstruction(ProcessingInstruction processingInstruction) throws IOException(Code) | | |
Methods inherited from org.xml.sax.helpers.XMLFilterImpl | public void characters(char ch, int start, int length) throws SAXException(Code)(Java Doc) public void endDocument() throws SAXException(Code)(Java Doc) public void endElement(String uri, String localName, String qName) throws SAXException(Code)(Java Doc) public void endPrefixMapping(String prefix) throws SAXException(Code)(Java Doc) public void error(SAXParseException e) throws SAXException(Code)(Java Doc) public void fatalError(SAXParseException e) throws SAXException(Code)(Java Doc) public ContentHandler getContentHandler()(Code)(Java Doc) public DTDHandler getDTDHandler()(Code)(Java Doc) public EntityResolver getEntityResolver()(Code)(Java Doc) public ErrorHandler getErrorHandler()(Code)(Java Doc) public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public XMLReader getParent()(Code)(Java Doc) public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public void ignorableWhitespace(char ch, int start, int length) throws SAXException(Code)(Java Doc) public void notationDecl(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc) public void parse(InputSource input) throws SAXException, IOException(Code)(Java Doc) public void parse(String systemId) throws SAXException, IOException(Code)(Java Doc) public void processingInstruction(String target, String data) throws SAXException(Code)(Java Doc) public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException(Code)(Java Doc) public void setContentHandler(ContentHandler handler)(Code)(Java Doc) public void setDTDHandler(DTDHandler handler)(Code)(Java Doc) public void setDocumentLocator(Locator locator)(Code)(Java Doc) public void setEntityResolver(EntityResolver resolver)(Code)(Java Doc) public void setErrorHandler(ErrorHandler handler)(Code)(Java Doc) public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public void setParent(XMLReader parent)(Code)(Java Doc) public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public void skippedEntity(String name) throws SAXException(Code)(Java Doc) public void startDocument() throws SAXException(Code)(Java Doc) public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException(Code)(Java Doc) public void startPrefixMapping(String prefix, String uri) throws SAXException(Code)(Java Doc) public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException(Code)(Java Doc) public void warning(SAXParseException e) throws SAXException(Code)(Java Doc)
|
|
|