Package de.hybris.bootstrap.xml
Class XMLWriter
- java.lang.Object
-
- de.hybris.bootstrap.xml.XMLWriter
-
public class XMLWriter extends java.lang.ObjectXML document writer based upon aXMLTagWritertree.Use like this:
XMLWriter wr = new XMLWriter( new FileWriter( "test.xml" ), new MyRootTagWriter() ); // optionally define the DTD wr.setDtd( new String[]{ "faces-config" // name "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN", // public "http://java.sun.com/dtd/web-facesconfig_1_1.dtd" // system } ); // optionally set encoding wr.setEncoding("UTF-8"); // write try { wr.write( new MyRootDataObject() ); } catch( XMLWriteException e ) { // report some error } finally { try{ wr.close() } catch( IOException e ){} }
-
-
Constructor Summary
Constructors Constructor Description XMLWriter(java.io.OutputStream os, XMLTagWriter root)Creates a new xml writer which wraps a exitingOutputStream.XMLWriter(java.io.Writer wr, XMLTagWriter root)Creates a new xml writer which wraps a exitingWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected org.znerd.xmlenc.XMLOutputtercreateXMLOutputter(java.io.Writer wr)protected voidendDocument(org.znerd.xmlenc.XMLOutputter xout)java.lang.String[]getDtd()java.lang.StringgetEncoding()java.lang.StringgetIndent()org.znerd.xmlenc.LineBreakgetLineBreak()chargetQuotation()XMLTagWritergetRootTagWriter()voidsetDtd(java.lang.String[] dtd)voidsetEncoding(java.lang.String encoding)voidsetIndent(java.lang.String indent)voidsetLineBreak(org.znerd.xmlenc.LineBreak lineBreak)voidsetQuotation(char quotation)protected voidstartDocument(org.znerd.xmlenc.XMLOutputter xout)voidwrite(java.lang.Object o)
-
-
-
Constructor Detail
-
XMLWriter
public XMLWriter(java.io.Writer wr, XMLTagWriter root)Creates a new xml writer which wraps a exitingWriter.- Parameters:
wr- the underlying writerroot- the root tag writer, must contain all sub tag writers of the document
-
XMLWriter
public XMLWriter(java.io.OutputStream os, XMLTagWriter root)Creates a new xml writer which wraps a exitingOutputStream.- Parameters:
os- the underlying output streamroot- the root tag writer, must contain all sub tag writers of the document
-
-
Method Detail
-
createXMLOutputter
protected org.znerd.xmlenc.XMLOutputter createXMLOutputter(java.io.Writer wr) throws java.io.UnsupportedEncodingException- Throws:
java.io.UnsupportedEncodingException
-
write
public void write(java.lang.Object o) throws XMLWriteException- Throws:
XMLWriteException
-
startDocument
protected void startDocument(org.znerd.xmlenc.XMLOutputter xout) throws XMLWriteException- Throws:
XMLWriteException
-
endDocument
protected void endDocument(org.znerd.xmlenc.XMLOutputter xout)
-
close
public void close() throws java.lang.IllegalStateException, java.io.IOException- Throws:
java.lang.IllegalStateExceptionjava.io.IOException
-
getDtd
public java.lang.String[] getDtd()
-
setDtd
public void setDtd(java.lang.String[] dtd)
-
getEncoding
public java.lang.String getEncoding()
-
setEncoding
public void setEncoding(java.lang.String encoding)
-
getIndent
public java.lang.String getIndent()
-
setIndent
public void setIndent(java.lang.String indent)
-
getLineBreak
public org.znerd.xmlenc.LineBreak getLineBreak()
-
setLineBreak
public void setLineBreak(org.znerd.xmlenc.LineBreak lineBreak)
-
getQuotation
public char getQuotation()
-
setQuotation
public void setQuotation(char quotation)
-
getRootTagWriter
public XMLTagWriter getRootTagWriter()
-
-