|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dom4j.jaxb.JAXBSupport
org.dom4j.jaxb.JAXBModifier
Reads an XML document using SAX and writes its content to the provided XMLWriter
.
Modifications must be provided by JAXBObjectModifier
objects,
which are called prior to writing the XML fragment they are registered for.
SAXModifier
Constructor Summary | |
JAXBModifier(java.lang.String contextPath)
Creates a new JAXBModifier for the given JAXB context path. |
|
JAXBModifier(java.lang.String contextPath,
java.lang.ClassLoader classloader)
Creates a new JAXBModifier for the given JAXB context path, using the given ClassLoader . |
|
JAXBModifier(java.lang.String contextPath,
java.lang.ClassLoader classloader,
OutputFormat outputFormat)
Creates a new JAXBModifier for the given JAXB context path, using the specified java.lang.Classloader . |
|
JAXBModifier(java.lang.String contextPath,
OutputFormat outputFormat)
Creates a new JAXBModifier for the given JAXB context path. |
Method Summary | |
void |
addObjectModifier(java.lang.String path,
JAXBObjectModifier modifier)
Adds the JAXBObjectModifier to be called
when the specified xml path is encounted while parsing the source. |
boolean |
isPruneElements()
Returns true when the modified Document is not kept in memory. |
protected Element |
marshal(javax.xml.bind.Element element)
Marshals the given Element in to its DOM4J counterpart. |
Document |
modify(java.io.File source)
Parses the specified File with SAX |
Document |
modify(java.io.File source,
java.nio.charset.Charset charset)
Parses the specified File with SAX,
using the given Charset . |
Document |
modify(InputSource source)
Parses the specified InputSource with SAX. |
Document |
modify(java.io.InputStream source)
Parses the specified InputStream with SAX. |
Document |
modify(java.io.InputStream source,
java.lang.String systemId)
Parses the specified InputStream with SAX. |
Document |
modify(java.io.Reader source)
Parses the specified Reader with SAX. |
Document |
modify(java.io.Reader source,
java.lang.String systemId)
Parses the specified Reader with SAX. |
Document |
modify(java.lang.String source)
Parses the the given URL or filename. |
Document |
modify(java.net.URL source)
Parses the the given URL. |
void |
removeObjectModifier(java.lang.String path)
Removes the JAXBObjectModifier from the event based processor,
for the specified element path. |
void |
resetObjectModifiers()
Removes all registered JAXBObjectModifier instances from the event based processor. |
void |
setOutput(java.io.File file)
Sets the Output to write the (modified) xml document to. |
void |
setOutput(java.io.OutputStream outputStream)
Sets the Output to write the (modified) xml document to. |
void |
setOutput(java.io.Writer writer)
Sets the Output to write the (modified) xml document to. |
void |
setPruneElements(boolean pruneElements)
Define whether the modified Document must only be written
to the output and pruned from the DOM4J tree. |
protected javax.xml.bind.Element |
unmarshal(Element element)
Unmarshalls the specified DOM4J Element into a Element |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JAXBModifier(java.lang.String contextPath)
contextPath
- JAXB context path to be usedJAXBContext
public JAXBModifier(java.lang.String contextPath, java.lang.ClassLoader classloader)
ClassLoader
.
This is the Java package where JAXB can find the generated XML classes.
This package MUST contain jaxb.properties!
contextPath
- JAXB context path to be usedclassloader
- the classloader to useJAXBContext
public JAXBModifier(java.lang.String contextPath, OutputFormat outputFormat)
OutputFormat
will be used while writing the XML stream.
contextPath
- JAXB context path to be usedoutputFormat
- the DOM4J OutputFormat
to be usedJAXBContext
public JAXBModifier(java.lang.String contextPath, java.lang.ClassLoader classloader, OutputFormat outputFormat)
java.lang.Classloader
.
The specified OutputFormat
will be used while writing the XML stream.
contextPath
- JAXB context path to be usedclassloader
- the class loader to be used to load JAXBoutputFormat
- the DOM4J OutputFormat
to be usedJAXBContext
Method Detail |
public Document modify(java.io.File source) throws DocumentException, java.io.IOException
File
with SAX
source
- the file to parse
DocumentException
- when an error occurs while parsing
java.io.IOException
- when an error occurs while writing to the XMLWriter
public Document modify(java.io.File source, java.nio.charset.Charset charset) throws DocumentException, java.io.IOException
File
with SAX,
using the given Charset
.
source
- the file to parsecharset
- the character set to use
DocumentException
- when an error occurs while parsing
java.io.IOException
- when an error occurs while writing to the XMLWriter
public Document modify(InputSource source) throws DocumentException, java.io.IOException
InputSource
with SAX.
source
- the input source to parse
DocumentException
- when an error occurs while parsing
java.io.IOException
- when an error occurs while writing to the XMLWriter
public Document modify(java.io.InputStream source) throws DocumentException, java.io.IOException
InputStream
with SAX.
source
- the inputstream to parse
DocumentException
- when an error occurs while parsing
java.io.IOException
- when an error occurs while writing to the XMLWriter
public Document modify(java.io.InputStream source, java.lang.String systemId) throws DocumentException, java.io.IOException
InputStream
with SAX.
source
- the inputstream to parsesystemId
- the URI of the given inputstream
DocumentException
- when an error occurs while parsing
java.io.IOException
- when an error occurs while writing to the XMLWriter
public Document modify(java.io.Reader source) throws DocumentException, java.io.IOException
Reader
with SAX.
source
- the reader to use for parsing
DocumentException
- when an error occurs while parsing
java.io.IOException
- when an error occurs while writing to the XMLWriter
public Document modify(java.io.Reader source, java.lang.String systemId) throws DocumentException, java.io.IOException
Reader
with SAX.
source
- the reader to parsesystemId
- the URI of the given reader
DocumentException
- when an error occurs while parsing
java.io.IOException
- when an error occurs while writing to the XMLWriter
public Document modify(java.lang.String source) throws DocumentException, java.io.IOException
source
- the URL or filename to parse
DocumentException
- when an error occurs while parsing
java.io.IOException
- when an error occurs while writing to the XMLWriter
public Document modify(java.net.URL source) throws DocumentException, java.io.IOException
source
- the URL to parse
DocumentException
- when an error occurs while parsing
java.io.IOException
- when an error occurs while writing to the XMLWriter
public void setOutput(java.io.File file) throws java.io.IOException
file
- the File
to write to
java.io.IOException
- when the file cannot be found or when the outputformatpublic void setOutput(java.io.OutputStream outputStream) throws java.io.IOException
outputStream
- the OutputStream
to write to
java.io.IOException
- when an error occurspublic void setOutput(java.io.Writer writer) throws java.io.IOException
writer
- the Writer
to write to
java.io.IOException
- when an error occurspublic void addObjectModifier(java.lang.String path, JAXBObjectModifier modifier)
JAXBObjectModifier
to be called
when the specified xml path is encounted while parsing the source.
path
- the element path to listen formodifier
- the modifier to registerpublic void removeObjectModifier(java.lang.String path)
JAXBObjectModifier
from the event based processor,
for the specified element path.
path
- the xml path to remove the modifier forpublic void resetObjectModifiers()
JAXBObjectModifier
instances from the event based processor.
public boolean isPruneElements()
Document
is not kept in memory.
public void setPruneElements(boolean pruneElements)
Document
must only be written
to the output and pruned from the DOM4J tree.
pruneElements
- When true, elements will not be kept in memoryprotected Element marshal(javax.xml.bind.Element element) throws javax.xml.bind.JAXBException
Element
in to its DOM4J counterpart.
element
- JAXB Element to be marshalled
Element
javax.xml.bind.JAXBException
- when an error occursprotected javax.xml.bind.Element unmarshal(Element element) throws javax.xml.bind.JAXBException
Element
into a Element
element
- the DOM4J element to unmarshall
javax.xml.bind.JAXBException
- when an error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |