Reads an XML document and creates a DOM4J tree from SAX parsing events.
objects can be registered to automatically receive
unmarshalled XML fragments. Registered {@linkorg.dom4j.ElementHandler}
implementations are notified when a certain element path is encountered
| Method from org.dom4j.jaxb.JAXBReader Detail: |
public void addHandler(String path,
ElementHandler handler) {
getReader().addHandler(path, handler);
}
Adds the ElementHandler to be called when the specified
path is encounted. |
public void addObjectHandler(String path,
JAXBObjectHandler handler) {
ElementHandler eHandler = new UnmarshalElementHandler(this, handler);
getReader().addHandler(path, eHandler);
}
Registers a JAXBObjectHandler that will be supplied with the
unmarshalled representation of the xml fragment whenever the specified
path is encounted. |
public boolean isPruneElements() {
return pruneElements;
}
When 'true', the DOM4J document will not be kept in memory while parsing. |
public Document read(File source) throws DocumentException {
return getReader().read(source);
}
|
public Document read(InputSource source) throws DocumentException {
try {
return getReader().read(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public Document read(InputStream source) throws DocumentException {
try {
return getReader().read(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public Document read(Reader source) throws DocumentException {
try {
return getReader().read(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public Document read(String source) throws DocumentException {
try {
return getReader().read(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
Parses the the given URL or filename. |
public Document read(URL source) throws DocumentException {
try {
return getReader().read(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
Parses the the given URL. |
public Document read(File file,
Charset charset) throws DocumentException {
try {
Reader xmlReader = new InputStreamReader(new FileInputStream(file),
charset);
return getReader().read(xmlReader);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
} catch (FileNotFoundException ex) {
throw new DocumentException(ex.getMessage(), ex);
}
}
|
public Document read(InputStream source,
String systemId) throws DocumentException {
try {
return getReader().read(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public Document read(Reader source,
String systemId) throws DocumentException {
try {
return getReader().read(source);
} catch (JAXBRuntimeException ex) {
Throwable cause = ex.getCause();
throw new DocumentException(cause.getMessage(), cause);
}
}
|
public void removeHandler(String path) {
getReader().removeHandler(path);
}
Removes the ElementHandler from the event based processor,
for the specified path. |
public void removeObjectHandler(String path) {
getReader().removeHandler(path);
}
Removes the JAXBObjectHandler from the event based processor, for
the specified element path. |
public void resetHandlers() {
getReader().resetHandlers();
}
|
public void setPruneElements(boolean pruneElements) {
this.pruneElements = pruneElements;
if (pruneElements) {
getReader().setDefaultHandler(new PruningElementHandler());
}
}
Set to true when DOM4J elements must immediately be pruned from the tree.
The Document will not be available afterwards! |