JavaType - the class of a (via JAXB generated) Java object, that the contained
Document is mapped topublic abstract class XmlDocument<JavaType> extends Object
Document, that provides functions for
conversion from / to Java objects.| Modifier | Constructor and Description |
|---|---|
protected |
XmlDocument(Document document)
Create from a
Document. |
| Modifier and Type | Method and Description |
|---|---|
Document |
getDocument()
Returns the
Document, that is contained by this object. |
boolean |
isTextWrittenAsCDATA()
Check, if text elements of generated XML should use CDATA.
|
protected void |
prepareDocumentBeforeWritingToXml(Document doc)
Make some modifications to a
Document, before it is written to XML. |
void |
setTextWrittenAsCDATA(boolean textsAsCDATA)
Enable CDATA for text elements in generated XML.
|
abstract JavaType |
toObject()
Creates an object from the contained
Document. |
void |
toXml(File xmlFile)
Generate XML for the contained
Document. |
void |
toXml(File xmlFile,
boolean prettyPrint)
Generate XML for the contained
Document. |
void |
toXml(OutputStream output)
Generate XML for the contained
Document. |
void |
toXml(OutputStream output,
boolean prettyPrint)
Generate XML for the contained
Document. |
void |
toXml(Writer output)
Generate XML for the contained
Document. |
void |
toXml(Writer output,
boolean prettyPrint)
Generate XML for the contained
Document. |
String |
toXmlString()
Returns XML for the contained
Document. |
String |
toXmlString(boolean prettyPrint)
Returns XML for the contained
Document. |
public final Document getDocument()
Document, that is contained by this object.public final boolean isTextWrittenAsCDATA()
protected void prepareDocumentBeforeWritingToXml(Document doc) throws IOException
Document, before it is written to XML.doc - the document, that will be written to XMLIOException - if an error occured and XML generation should be stoppedpublic void setTextWrittenAsCDATA(boolean textsAsCDATA)
textsAsCDATA - true, if CDATA is used for XML generationpublic abstract JavaType toObject() throws JAXBException
Document.DocumentJAXBException - if the Java object is not creatablepublic final void toXml(File xmlFile) throws TransformerException, IOException
Document.xmlFile - the file, where the XML code is written toTransformerException - if XML transformation failedIOException - if writing failedpublic void toXml(File xmlFile, boolean prettyPrint) throws TransformerException, IOException
Document.xmlFile - the file, where the XML code is written toprettyPrint - if pretty printing is enabled for the generated XML codeTransformerException - if XML transformation failedIOException - if writing failedpublic final void toXml(OutputStream output) throws TransformerException, IOException
Document.output - the output, where the XML code is written toTransformerException - if XML transformation failedIOException - if writing failedpublic void toXml(OutputStream output, boolean prettyPrint) throws TransformerException, IOException
Document.output - the output, where the XML code is written toprettyPrint - if pretty printing is enabled for the generated XML codeTransformerException - if XML transformation failedIOException - if writing failedpublic final void toXml(Writer output) throws TransformerException, IOException
Document.output - the output, where the XML code is written toTransformerException - if XML transformation failedIOException - if writing failedpublic void toXml(Writer output, boolean prettyPrint) throws TransformerException, IOException
Document.output - the output, where the XML code is written toprettyPrint - if pretty printing is enabled for the generated XML codeTransformerException - if XML transformation failedIOException - if writing failedpublic String toXmlString() throws TransformerException, IOException
Document.TransformerException - if XML transformation failedIOException - if writing failedpublic final String toXmlString(boolean prettyPrint) throws TransformerException, IOException
Document.prettyPrint - if pretty printing is enabled for the generated XML codeTransformerException - if XML transformation failedIOException - if writing failedCopyright © 2015 OpenEstate. All rights reserved.