Reads an XML document using SAX and writes its content to the provided
. Modifications must be provided by
objects, which are called prior to writing
the XML fragment they are registered for.
| Constructor: |
public JAXBModifier(String contextPath) {
super(contextPath);
this.outputFormat = new OutputFormat();
}
Creates a new JAXBModifier 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! |
public JAXBModifier(String contextPath,
ClassLoader classloader) {
super(contextPath, classloader);
this.outputFormat = new OutputFormat();
}
Creates a new JAXBModifier for the given JAXB context path, using the
given java.lang.ClassLoader . This is the Java package where JAXB
can find the generated XML classes. This package MUST contain
jaxb.properties! |
public JAXBModifier(String contextPath,
OutputFormat outputFormat) {
super(contextPath);
this.outputFormat = outputFormat;
}
Creates a new JAXBModifier for the given JAXB context path. The specified
org.dom4j.io.OutputFormat will be used while writing the XML
stream. |
public JAXBModifier(String contextPath,
ClassLoader classloader,
OutputFormat outputFormat) {
super(contextPath, classloader);
this.outputFormat = outputFormat;
}
|
| Method from org.dom4j.jaxb.JAXBModifier Detail: |
public void addObjectModifier(String path,
JAXBObjectModifier mod) {
modifiers.put(path, mod);
}
Adds the JAXBObjectModifier to be called when the specified xml
path is encounted while parsing the source. |
public boolean isPruneElements() {
return pruneElements;
}
|
public Document modify(File source) throws IOException, DocumentException {
return installModifier().modify(source);
}
|
public Document modify(InputSource source) throws IOException, DocumentException {
try {
return installModifier().modify(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public Document modify(InputStream source) throws IOException, DocumentException {
try {
return installModifier().modify(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public Document modify(Reader r) throws IOException, DocumentException {
try {
return installModifier().modify(r);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public Document modify(String url) throws IOException, DocumentException {
try {
return installModifier().modify(url);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
Parses the the given URL or filename. |
public Document modify(URL source) throws IOException, DocumentException {
try {
return installModifier().modify(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
Parses the the given URL. |
public Document modify(File source,
Charset charset) throws IOException, DocumentException {
try {
Reader reader = new InputStreamReader(new FileInputStream(source),
charset);
return installModifier().modify(reader);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
} catch (FileNotFoundException ex) {
throw new DocumentException(ex.getMessage(), ex);
}
}
|
public Document modify(InputStream source,
String systemId) throws IOException, DocumentException {
try {
return installModifier().modify(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public Document modify(Reader source,
String systemId) throws IOException, DocumentException {
try {
return installModifier().modify(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public void removeObjectModifier(String path) {
modifiers.remove(path);
getModifier().removeModifier(path);
}
Removes the JAXBObjectModifier from the event based processor,
for the specified element path. |
public void resetObjectModifiers() {
modifiers.clear();
getModifier().resetModifiers();
}
|
public void setOutput(File file) throws IOException {
createXMLWriter().setOutputStream(new FileOutputStream(file));
}
Sets the Output to write the (modified) xml document to. |
public void setOutput(OutputStream outputStream) throws IOException {
createXMLWriter().setOutputStream(outputStream);
}
Sets the Output to write the (modified) xml document to. |
public void setOutput(Writer writer) throws IOException {
createXMLWriter().setWriter(writer);
}
Sets the Output to write the (modified) xml document to. |
public void setPruneElements(boolean pruneElements) {
this.pruneElements = pruneElements;
}
Define whether the modified org.dom4j.Document must only be
written to the output and pruned from the DOM4J tree. |