|
Openfire 3.4.3 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.XMLFilterImpl org.jivesoftware.util.XMLWriter
public class XMLWriter
Replacement class of the original XMLWriter.java (version: 1.77) since the original is still using StringBuffer which is not fast.
Field Summary | |
---|---|
protected static org.dom4j.io.OutputFormat |
DEFAULT_FORMAT
|
protected int |
lastOutputNodeType
Stores the last type of node written so algorithms can refer to the previous node type |
protected static String[] |
LEXICAL_HANDLER_NAMES
|
protected boolean |
preserve
Stores the xml:space attribute value of preserve for whitespace flag |
protected Writer |
writer
The Writer used to output to |
Constructor Summary | |
---|---|
XMLWriter()
|
|
XMLWriter(org.dom4j.io.OutputFormat format)
|
|
XMLWriter(OutputStream out)
|
|
XMLWriter(OutputStream out,
org.dom4j.io.OutputFormat format)
|
|
XMLWriter(Writer writer)
|
|
XMLWriter(Writer writer,
org.dom4j.io.OutputFormat format)
|
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
|
void |
close()
Closes the underlying Writer |
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). |
void |
endCDATA()
|
void |
endDocument()
|
void |
endDTD()
|
void |
endElement(String namespaceURI,
String localName,
String qName)
|
void |
endEntity(String name)
|
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. |
void |
flush()
Flushes the underlying Writer |
LexicalHandler |
getLexicalHandler()
|
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 org.dom4j.io.OutputFormat |
getOutputFormat()
Lets subclasses get at the current format object, so they can call setTrimText, setNewLines, etc. |
Object |
getProperty(String name)
|
protected void |
handleException(IOException e)
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
protected void |
indent()
|
protected void |
installLexicalHandler()
|
protected boolean |
isElementSpacePreserved(org.dom4j.Element element)
Determines if element is a special case of XML elements where it contains an xml:space attribute of "preserve". |
boolean |
isEscapeText()
|
protected boolean |
isExpandEmptyElements()
|
protected boolean |
isNamespaceDeclaration(org.dom4j.Namespace ns)
|
void |
notationDecl(String name,
String publicID,
String systemID)
|
void |
parse(InputSource source)
|
void |
println()
Writes the new line text to the underlying Writer |
void |
processingInstruction(String target,
String data)
|
boolean |
resolveEntityRefs()
|
void |
setDocumentLocator(Locator locator)
|
void |
setEscapeText(boolean escapeText)
Sets whether text output should be escaped or not. |
void |
setIndentLevel(int indentLevel)
Set the initial indentation level. |
void |
setLexicalHandler(LexicalHandler handler)
|
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. |
void |
setOutputStream(OutputStream out)
|
void |
setProperty(String name,
Object value)
|
void |
setResolveEntityRefs(boolean resolve)
|
void |
setWriter(Writer writer)
|
protected boolean |
shouldEncodeChar(char c)
Should the given character be escaped. |
void |
startCDATA()
|
void |
startDocument()
|
void |
startDTD(String name,
String publicID,
String systemID)
|
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes attributes)
|
void |
startEntity(String name)
|
void |
startPrefixMapping(String prefix,
String uri)
|
void |
unparsedEntityDecl(String name,
String publicID,
String systemID,
String notationName)
|
void |
write(org.dom4j.Attribute attribute)
Writes the given Attribute . |
void |
write(org.dom4j.CDATA cdata)
Writes the given CDATA . |
void |
write(org.dom4j.Comment comment)
Writes the given Comment . |
void |
write(org.dom4j.Document doc)
This will print the Document to the current Writer. |
void |
write(org.dom4j.DocumentType docType)
Writes the given DocumentType . |
void |
write(org.dom4j.Element element)
Writes the , including
its s, and its value, and all
its content (child nodes) to the current Writer. |
void |
write(org.dom4j.Entity entity)
Writes the given Entity . |
void |
write(org.dom4j.Namespace namespace)
Writes the given Namespace . |
void |
write(org.dom4j.Node node)
Writes the given Node . |
void |
write(Object object)
Writes the given object which should be a String, a Node or a List of Nodes. |
void |
write(org.dom4j.ProcessingInstruction processingInstruction)
Writes the given ProcessingInstruction . |
void |
write(String text)
Print out a String , Perfoms
the necessary entity escaping and whitespace stripping. |
void |
write(org.dom4j.Text text)
Writes the given Text . |
protected void |
writeAttribute(org.dom4j.Attribute attribute)
|
protected void |
writeAttribute(Attributes attributes,
int index)
|
protected void |
writeAttributes(Attributes attributes)
|
protected void |
writeAttributes(org.dom4j.Element element)
Writes the attributes of the given element |
protected void |
writeCDATA(String text)
|
void |
writeClose(org.dom4j.Element element)
Writes the closing tag of an 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(org.dom4j.DocumentType docType)
|
protected void |
writeDocType(String name,
String publicID,
String systemID)
|
protected void |
writeElement(org.dom4j.Element element)
|
protected void |
writeElementContent(org.dom4j.Element element)
Outputs the content of the given element. |
protected void |
writeEmptyElementClose(String qualifiedName)
|
protected void |
writeEntity(org.dom4j.Entity entity)
|
protected void |
writeEntityRef(String name)
|
protected void |
writeEscapeAttributeEntities(String text)
|
protected void |
writeNamespace(org.dom4j.Namespace namespace)
|
protected void |
writeNamespace(String prefix,
String uri)
Writes the SAX namepsaces |
protected void |
writeNamespaces()
Writes the SAX namepsaces |
protected void |
writeNode(org.dom4j.Node node)
|
protected void |
writeNodeText(org.dom4j.Node node)
This method is used to write out Nodes that contain text and still allow for xml:space to be handled properly. |
void |
writeOpen(org.dom4j.Element element)
Writes the opening tag of an Element ,
including its Attribute s
but without its content. |
protected void |
writePrintln()
This will print a new line only if the newlines flag was set to true |
protected void |
writeProcessingInstruction(org.dom4j.ProcessingInstruction processingInstruction)
|
protected void |
writeString(String text)
|
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
---|
error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, parse, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, skippedEntity, warning |
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 org.dom4j.io.OutputFormat DEFAULT_FORMAT
protected int lastOutputNodeType
protected boolean preserve
protected Writer writer
Constructor Detail |
---|
public XMLWriter(Writer writer)
public XMLWriter(Writer writer, org.dom4j.io.OutputFormat format)
public XMLWriter() throws UnsupportedEncodingException
UnsupportedEncodingException
public XMLWriter(OutputStream out) throws UnsupportedEncodingException
UnsupportedEncodingException
public XMLWriter(OutputStream out, org.dom4j.io.OutputFormat format) throws UnsupportedEncodingException
UnsupportedEncodingException
public XMLWriter(org.dom4j.io.OutputFormat format) throws UnsupportedEncodingException
UnsupportedEncodingException
Method Detail |
---|
public void setWriter(Writer writer)
public void setOutputStream(OutputStream out) throws UnsupportedEncodingException
UnsupportedEncodingException
public boolean isEscapeText()
public void setEscapeText(boolean escapeText)
public void setIndentLevel(int indentLevel)
indentLevel
- the number of indents to start withpublic int getMaximumAllowedCharacter()
public void setMaximumAllowedCharacter(int maximumAllowedCharacter)
maximumAllowedCharacter
- The maximumAllowedCharacter to setpublic void flush() throws IOException
IOException
public void close() throws IOException
IOException
public void println() throws IOException
IOException
public void write(org.dom4j.Attribute attribute) throws IOException
Attribute
.
attribute
- Attribute
to output.
IOException
public void write(org.dom4j.Document doc) throws IOException
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.
doc
- Document
to format.
IOException
- - if there's any problem writing.public void write(org.dom4j.Element element) throws IOException
Writes the
, including
its Element
s, and its value, and all
its content (child nodes) to the current Writer.Attribute
element
- Element
to output.
IOException
public void write(org.dom4j.CDATA cdata) throws IOException
CDATA
.
cdata
- CDATA
to output.
IOException
public void write(org.dom4j.Comment comment) throws IOException
Comment
.
comment
- Comment
to output.
IOException
public void write(org.dom4j.DocumentType docType) throws IOException
DocumentType
.
docType
- DocumentType
to output.
IOException
public void write(org.dom4j.Entity entity) throws IOException
Entity
.
entity
- Entity
to output.
IOException
public void write(org.dom4j.Namespace namespace) throws IOException
Namespace
.
namespace
- Namespace
to output.
IOException
public void write(org.dom4j.ProcessingInstruction processingInstruction) throws IOException
ProcessingInstruction
.
processingInstruction
- ProcessingInstruction
to output.
IOException
public void write(String text) throws IOException
Print out a String
, Perfoms
the necessary entity escaping and whitespace stripping.
text
- is the text to output
IOException
public void write(org.dom4j.Text text) throws IOException
Text
.
text
- Text
to output.
IOException
public void write(org.dom4j.Node node) throws IOException
Node
.
node
- Node
to output.
IOException
public void write(Object object) throws IOException
object
- is the object to output.
IOException
public void writeOpen(org.dom4j.Element element) throws IOException
Writes the opening tag of an Element
,
including its Attribute
s
but without its content.
element
- Element
to output.
IOException
public void writeClose(org.dom4j.Element element) throws IOException
Writes the closing tag of an Element
element
- Element
to output.
IOException
public void parse(InputSource source) throws IOException, SAXException
parse
in interface XMLReader
parse
in class XMLFilterImpl
IOException
SAXException
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
setProperty
in interface XMLReader
setProperty
in class XMLFilterImpl
SAXNotRecognizedException
SAXNotSupportedException
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty
in interface XMLReader
getProperty
in class XMLFilterImpl
SAXNotRecognizedException
SAXNotSupportedException
public void setLexicalHandler(LexicalHandler handler)
public LexicalHandler getLexicalHandler()
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class XMLFilterImpl
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class XMLFilterImpl
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class XMLFilterImpl
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class XMLFilterImpl
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class XMLFilterImpl
SAXException
public void startElement(String namespaceURI, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class XMLFilterImpl
SAXException
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class XMLFilterImpl
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class XMLFilterImpl
SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
in interface ContentHandler
ignorableWhitespace
in class XMLFilterImpl
SAXException
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
processingInstruction
in class XMLFilterImpl
SAXException
public void notationDecl(String name, String publicID, String systemID) throws SAXException
notationDecl
in interface DTDHandler
notationDecl
in class XMLFilterImpl
SAXException
public void unparsedEntityDecl(String name, String publicID, String systemID, String notationName) throws SAXException
unparsedEntityDecl
in interface DTDHandler
unparsedEntityDecl
in class XMLFilterImpl
SAXException
public void startDTD(String name, String publicID, String systemID) throws SAXException
startDTD
in interface LexicalHandler
SAXException
public void endDTD() throws SAXException
endDTD
in interface LexicalHandler
SAXException
public void startCDATA() throws SAXException
startCDATA
in interface LexicalHandler
SAXException
public void endCDATA() throws SAXException
endCDATA
in interface LexicalHandler
SAXException
public void startEntity(String name) throws SAXException
startEntity
in interface LexicalHandler
SAXException
public void endEntity(String name) throws SAXException
endEntity
in interface LexicalHandler
SAXException
public void comment(char[] ch, int start, int length) throws SAXException
comment
in interface LexicalHandler
SAXException
protected void writeElement(org.dom4j.Element element) throws IOException
IOException
protected final boolean isElementSpacePreserved(org.dom4j.Element element)
protected void writeElementContent(org.dom4j.Element element) throws IOException
IOException
protected void writeCDATA(String text) throws IOException
IOException
protected void writeDocType(org.dom4j.DocumentType docType) throws IOException
IOException
protected void writeNamespace(org.dom4j.Namespace namespace) throws IOException
IOException
protected void writeNamespaces() throws IOException
IOException
protected void writeNamespace(String prefix, String uri) throws IOException
IOException
protected void writeProcessingInstruction(org.dom4j.ProcessingInstruction processingInstruction) throws IOException
IOException
protected void writeString(String text) throws IOException
IOException
protected void writeNodeText(org.dom4j.Node node) throws IOException
IOException
protected void writeNode(org.dom4j.Node node) throws IOException
IOException
protected void installLexicalHandler()
protected void writeDocType(String name, String publicID, String systemID) throws IOException
IOException
protected void writeEntity(org.dom4j.Entity entity) throws IOException
IOException
protected void writeEntityRef(String name) throws IOException
IOException
protected void writeComment(String text) throws IOException
IOException
protected void writeAttributes(org.dom4j.Element element) throws IOException
IOException
protected void writeAttribute(org.dom4j.Attribute attribute) throws IOException
IOException
protected void writeAttributes(Attributes attributes) throws IOException
IOException
protected void writeAttribute(Attributes attributes, int index) throws IOException
IOException
protected void indent() throws IOException
IOException
protected void writePrintln() throws IOException
This will print a new line only if the newlines flag was set to true
IOException
protected Writer createWriter(OutputStream outStream, String encoding) throws UnsupportedEncodingException
UnsupportedEncodingException
protected void writeDeclaration() throws IOException
This will write the declaration to the given Writer. Assumes XML version 1.0 since we don't directly know.
IOException
protected void writeClose(String qualifiedName) throws IOException
IOException
protected void writeEmptyElementClose(String qualifiedName) throws IOException
IOException
protected boolean isExpandEmptyElements()
protected String escapeElementEntities(String text)
protected void writeEscapeAttributeEntities(String text) throws IOException
IOException
protected String escapeAttributeEntities(String text)
protected boolean shouldEncodeChar(char c)
protected int defaultMaximumAllowedCharacter()
protected boolean isNamespaceDeclaration(org.dom4j.Namespace ns)
protected void handleException(IOException e) throws SAXException
SAXException
protected org.dom4j.io.OutputFormat getOutputFormat()
public boolean resolveEntityRefs()
public void setResolveEntityRefs(boolean resolve)
|
Openfire 3.4.3 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |