Class JAXBWriter
java.lang.Object
org.dom4j.jaxb.JAXBSupport
org.dom4j.jaxb.JAXBWriter
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJAXBWriter(String contextPath) Creates a new JAXBWriter for the given JAXB context path.JAXBWriter(String contextPath, ClassLoader classloader) Creates a new JAXBWriter for the given JAXB context path, using the specifiedClassLoader.JAXBWriter(String contextPath, ClassLoader classloader, OutputFormat outputFormat) Creates a new JAXBWriter for the given JAXB context path, using the specifiedClassLoader.JAXBWriter(String contextPath, OutputFormat outputFormat) Creates a new JAXBWriter for the given JAXB context path. -
Method Summary
Modifier and TypeMethodDescriptionvoidStop writing the document to the output.Returns the OutputFormat that will be used when writing the XML stream.private XMLWritervoidDefines to write the resulting output to the specifiedFile.voidsetOutput(OutputStream outputStream) Defines to write the resulting output to the specifiedOutputStreamvoidDefines to write the resulting output to the specifiedWriter.voidStart a document by writing the initial XML declaration to the output.voidWrites the specifiedElementto the document.voidwriteClose(Element jaxbObject) Writes the closing tag of the specifiedElementto the document.voidwriteCloseElement(Element element) Writes the closing tag of the specifiedElementto the document.voidwriteElement(Element element) Writes the specifiedElementto the document.voidWrites the opening tag of the specifiedElementto the document.voidwriteOpenElement(Element element) Writes the opening tag of the specifiedElementto the document.Methods inherited from class JAXBSupport
marshal, unmarshal
-
Field Details
-
xmlWriter
-
outputFormat
-
-
Constructor Details
-
JAXBWriter
Creates a new JAXBWriter for the given JAXB context path. This is the Java package where JAXB can find the generated XML classes. This package MUST contain jaxb.properties!- Parameters:
contextPath- JAXB context path to be used- See Also:
-
JAXBWriter
Creates a new JAXBWriter for the given JAXB context path. The speciedOutputFormatwill be used for writing the XML stream.- Parameters:
contextPath- JAXB context path to be usedoutputFormat- the DOM4JOutputFormatto be used- See Also:
-
JAXBWriter
Creates a new JAXBWriter for the given JAXB context path, using the specifiedClassLoader. (This is the Java package where JAXB can find the generated XML classes. This package MUST contain jaxb.properties!)- Parameters:
contextPath- JAXB context path to be usedclassloader- the classloader to be used for loading JAXB- See Also:
-
JAXBWriter
Creates a new JAXBWriter for the given JAXB context path, using the specifiedClassLoader. The speciedOutputFormatwill be used while writing the XML stream.- Parameters:
contextPath- JAXB context path to be usedclassloader- the class loader to be used to load JAXBoutputFormat- the DOM4JOutputFormatto be used- See Also:
-
-
Method Details
-
getOutputFormat
Returns the OutputFormat that will be used when writing the XML stream.- Returns:
- Returns the output format.
-
setOutput
Defines to write the resulting output to the specifiedFile.- Parameters:
file- file to write to- Throws:
IOException- when the file cannot be found
-
setOutput
Defines to write the resulting output to the specifiedOutputStream- Parameters:
outputStream- outputStream to write to.- Throws:
IOException- DOCUMENT ME!
-
setOutput
Defines to write the resulting output to the specifiedWriter.- Parameters:
writer- writer to write to- Throws:
IOException- DOCUMENT ME!
-
startDocument
Start a document by writing the initial XML declaration to the output. This must be done prior to writing any other elements.- Throws:
IOException- if an error occured while writing the outputSAXException- thrown by the underlying SAX driver
-
endDocument
Stop writing the document to the output. This must be done when all other elements are finished.- Throws:
IOException- if an error occured while writing the outputSAXException- thrown by the underlying SAX driver
-
write
Writes the specifiedElementto the document.Elementinstances can be created using the ObjectFactory that is generated by the JAXB compiler.- Parameters:
jaxbObject- DOCUMENT ME!- Throws:
IOException- if an error occured while writing the outputJAXBException- when an error occured while marshalling the jaxbObject
-
writeClose
Writes the closing tag of the specifiedElementto the document. This method can be used for writingElementinstances can be created using the ObjectFactory that is generated by the JAXB compiler.- Parameters:
jaxbObject- the JAXB element to write- Throws:
IOException- if an error occured while writing the outputJAXBException- when an error occured while marshalling the jaxbObject
-
writeOpen
Writes the opening tag of the specifiedElementto the document.Elementinstances can be created using the ObjectFactory that is generated by the JAXB compiler.- Parameters:
jaxbObject- the JAXB element to write- Throws:
IOException- if an error occured while writing the outputJAXBException- when an error occured while marshalling the jaxbObject
-
writeElement
Writes the specifiedElementto the document.- Parameters:
element- theElementto write- Throws:
IOException- if an error occured while writing the output
-
writeCloseElement
Writes the closing tag of the specifiedElementto the document.- Parameters:
element- theElementto write- Throws:
IOException- if an error occured while writing the output
-
writeOpenElement
Writes the opening tag of the specifiedElementto the document.- Parameters:
element- theElementto write- Throws:
IOException- if an error occured while writing the output
-
getWriter
- Throws:
IOException
-