|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
com.alkacon.diff.XmlSaxWriter
public class XmlSaxWriter
Simple SAX event handler that generates a XML (or HTML) file from the events caught.
This can be used for writing large XML files where keeping a DOM structure in memory might cause out-of-memory issues, like e.g. when writing the OpenCms export files.
It can also be used if a is needed that should
generate a XML / HTML file from a series of SAX events.ContentHandler
| Constructor Summary | |
|---|---|
XmlSaxWriter(java.io.Writer writer)
A SAX event handler that generates XML / HTML Strings from the events caught and writes them to the given Writer. |
|
| Method Summary | |
|---|---|
void |
characters(char[] buf,
int offset,
int len)
|
void |
comment(char[] ch,
int start,
int length)
|
void |
endCDATA()
|
void |
endDocument()
|
void |
endDTD()
|
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName)
|
void |
endEntity(java.lang.String name)
|
static java.lang.String |
escapeXml(java.lang.String source)
Escapes a String so it may be printed as text content or attribute value in a HTML page or an XML file. |
java.io.Writer |
getWriter()
Returns the Writer where the XML is written to. |
boolean |
isEscapeXml()
Returns true if XML entities are to be encoded in the generated output (not in CDATA elements). |
boolean |
isIndentXml()
Returns true if the generated XML is to be indented using newlines and tabs in the generated output. |
void |
setEscapeXml(boolean value)
If set to true, then
XML entities are to be encoded in the generated output (not in CDATA elements). |
void |
setIndentXml(boolean value)
If set to true, then
the generated XML is to be indented using newlines and tabs in the generated output. |
void |
startCDATA()
|
void |
startDocument()
|
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
|
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes attributes)
|
void |
startEntity(java.lang.String name)
|
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlSaxWriter(java.io.Writer writer)
writer - the Writer to write to output to| Method Detail |
|---|
public static java.lang.String escapeXml(java.lang.String source)
This method replaces the following characters in a String:
source - the string to escape
public void characters(char[] buf,
int offset,
int len)
throws org.xml.sax.SAXException
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionContentHandler.characters(char[], int, int)
public void comment(char[] ch,
int start,
int length)
comment in interface org.xml.sax.ext.LexicalHandlerLexicalHandler.comment(char[], int, int)
public void endCDATA()
throws org.xml.sax.SAXException
endCDATA in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionLexicalHandler.endCDATA()
public void endDocument()
throws org.xml.sax.SAXException
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionContentHandler.endDocument()public void endDTD()
endDTD in interface org.xml.sax.ext.LexicalHandlerLexicalHandler.endDTD()
public void endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)public void endEntity(java.lang.String name)
endEntity in interface org.xml.sax.ext.LexicalHandlerLexicalHandler.endEntity(java.lang.String)public java.io.Writer getWriter()
public boolean isEscapeXml()
true if XML entities are to be encoded in the generated output (not in CDATA elements).
true if XML entities are to be encoded in the generated output (not in CDATA elements)public boolean isIndentXml()
true if the generated XML is to be indented using newlines and tabs in the generated output.
true if the generated XML is to be indented using newlines and tabs in the generated outputpublic void setEscapeXml(boolean value)
true, then
XML entities are to be encoded in the generated output (not in CDATA elements).
value - indicates to to escape characters with XML entities or notpublic void setIndentXml(boolean value)
true, then
the generated XML is to be indented using newlines and tabs in the generated output.
value - indicates to to indent the output XML or notpublic void startCDATA()
startCDATA in interface org.xml.sax.ext.LexicalHandlerLexicalHandler.startCDATA()
public void startDocument()
throws org.xml.sax.SAXException
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionContentHandler.startDocument()
public void startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
startDTD in interface org.xml.sax.ext.LexicalHandlerLexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)public void startEntity(java.lang.String name)
startEntity in interface org.xml.sax.ext.LexicalHandlerLexicalHandler.startEntity(java.lang.String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||