|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
org.dom4j.jaxb Class JAXBWriter
java.lang.Objectorg.dom4j.jaxb.JAXBSupport
org.dom4j.jaxb.JAXBWriter
- public class JAXBWriter
- extends org.dom4j.jaxb.JAXBSupport
Writes Elementobjects to an XML stream. Element instances can be created using the ObjectFactory that
is generated by the JAXB compiler.
- Author:
- Wonne Keysers (Realsoftware.be)
- See Also:
XMLWriter,JAXBContext
| Constructor Summary | |
JAXBWriter(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 specified Classloader. |
|
JAXBWriter(String contextPath,
ClassLoader classloader,
OutputFormat outputFormat)
Creates a new JAXBWriter for the given JAXB context path, using the specified Classloader. |
|
JAXBWriter(String contextPath,
OutputFormat outputFormat)
Creates a new JAXBWriter for the given JAXB context path. |
|
| Method Summary | |
void |
endDocument()
Stop writing the document to the output. |
OutputFormat |
getOutputFormat()
Returns the OutputFormat that will be used when writing the XML stream. |
protected Element |
marshal(javax.xml.bind.Element element)
Marshals the given Elementin to its DOM4J
counterpart. |
void |
setOutput(File file)
Defines to write the resulting output to the specified File. |
void |
setOutput(OutputStream outputStream)
Defines to write the resulting output to the specified OutputStream |
void |
setOutput(Writer writer)
Defines to write the resulting output to the specified Writer. |
void |
startDocument()
Start a document by writing the initial XML declaration to the output. |
protected javax.xml.bind.Element |
unmarshal(Element element)
Unmarshalls the specified DOM4J Elementinto a Element |
void |
write(javax.xml.bind.Element jaxbObject)
Writes the specified Elementto the document.
|
void |
writeClose(javax.xml.bind.Element jaxbObject)
Writes the closing tag of the specified Elementto
the document. |
void |
writeCloseElement(Element element)
Writes the closing tag of the specified Elementto the
document. |
void |
writeElement(Element element)
Writes the specified Elementto the document. |
void |
writeOpen(javax.xml.bind.Element jaxbObject)
Writes the opening tag of the specified Elementto
the document. |
void |
writeOpenElement(Element element)
Writes the opening tag of the specified Elementto the
document. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
JAXBWriter
public JAXBWriter(String contextPath)
- 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:
JAXBContext
JAXBWriter
public JAXBWriter(String contextPath, OutputFormat outputFormat)
- Creates a new JAXBWriter for the given JAXB context path. The specied
OutputFormatwill be used for writing the XML stream. - Parameters:
contextPath- JAXB context path to be usedoutputFormat- the DOM4JOutputFormatto be used- See Also:
JAXBContext
JAXBWriter
public JAXBWriter(String contextPath, ClassLoader classloader)
- Creates a new JAXBWriter for the given JAXB context path, using the
specified
Classloader. (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:
JAXBContext
JAXBWriter
public JAXBWriter(String contextPath, ClassLoader classloader, OutputFormat outputFormat)
- Creates a new JAXBWriter for the given JAXB context path, using the
specified
Classloader. 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:
JAXBContext
| Method Detail |
getOutputFormat
public OutputFormat getOutputFormat()
- Returns the OutputFormat that will be used when writing the XML stream.
- Returns:
- Returns the output format.
setOutput
public void setOutput(File file) throws IOException
- Defines to write the resulting output to the specified
File. - Parameters:
file- file to write to- Throws:
IOException- when the file cannot be found
setOutput
public void setOutput(OutputStream outputStream) throws IOException
- Defines to write the resulting output to the specified
OutputStream - Parameters:
outputStream- outputStream to write to.- Throws:
IOException- DOCUMENT ME!
setOutput
public void setOutput(Writer writer) throws IOException
- Defines to write the resulting output to the specified
Writer. - Parameters:
writer- writer to write to- Throws:
IOException
startDocument
public void startDocument()
throws IOException,
SAXException
- 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
public void endDocument()
throws IOException,
SAXException
- 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
public void write(javax.xml.bind.Element jaxbObject)
throws IOException,
javax.xml.bind.JAXBException
- Writes the specified
Elementto the document.Elementinstances can be created using the ObjectFactory that is generated by the JAXB compiler. - Parameters:
jaxbObject-- Throws:
IOException- if an error occured while writing the outputjavax.xml.bind.JAXBException- when an error occured while marshalling the jaxbObject
writeClose
public void writeClose(javax.xml.bind.Element jaxbObject)
throws IOException,
javax.xml.bind.JAXBException
- Writes the closing tag of the specified
Elementto 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 outputjavax.xml.bind.JAXBException- when an error occured while marshalling the jaxbObject
writeOpen
public void writeOpen(javax.xml.bind.Element jaxbObject)
throws IOException,
javax.xml.bind.JAXBException
- Writes the opening tag of the specified
Elementto 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 outputjavax.xml.bind.JAXBException- when an error occured while marshalling the jaxbObject
writeElement
public void writeElement(Element element) throws IOException
- Writes the specified
Elementto the document. - Parameters:
element- theElementto write- Throws:
IOException- if an error occured while writing the output
writeCloseElement
public void writeCloseElement(Element element) throws IOException
- Writes the closing tag of the specified
Elementto the document. - Parameters:
element- theElementto write- Throws:
IOException- if an error occured while writing the output
writeOpenElement
public void writeOpenElement(Element element) throws IOException
- Writes the opening tag of the specified
Elementto the document. - Parameters:
element- theElementto write- Throws:
IOException- if an error occured while writing the output
marshal
protected Element marshal(javax.xml.bind.Element element) throws javax.xml.bind.JAXBException
- Marshals the given
Elementin to its DOM4J counterpart. - Parameters:
element- JAXB Element to be marshalled- Returns:
- the marshalled DOM4J
Element - Throws:
javax.xml.bind.JAXBException- when an error occurs
unmarshal
protected javax.xml.bind.Element unmarshal(Element element) throws javax.xml.bind.JAXBException
- Unmarshalls the specified DOM4J
Elementinto aElement - Parameters:
element- the DOM4J element to unmarshall- Returns:
- the unmarshalled JAXB object
- Throws:
javax.xml.bind.JAXBException- when an error occurs
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Copyright © 2001-2005 MetaStuff Ltd.. All Rights Reserved.
org.dom4j.jaxb.JAXBSupport