| 
 | |||||||||||
| 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.JAXBReader
Reads an XML document and creates a DOM4J tree from SAX parsing events.
 JAXBObjectHandlerobjects can be registered to automatically receive
 unmarshalled XML fragments. Registered 
 implementations are notified when a certain element path is encountered
SAXReader, 
JAXBContext| Constructor Summary | |
| JAXBReader(String contextPath)Creates a new JAXBReader for the given JAXB context path. | |
| JAXBReader(String contextPath,
           ClassLoader classloader)Creates a new JAXBReader for the given JAXB context path, using the specified Classloader. | |
| Method Summary | |
|  void | addHandler(String path,
           ElementHandler handler)Adds the ElementHandlerto be called when the specified
 path is encounted. | 
|  void | addObjectHandler(String path,
                 JAXBObjectHandler handler)Registers a JAXBObjectHandlerthat will be supplied with the
 unmarshalled representation of the xml fragment whenever the specified
 path is encounted. | 
|  boolean | isPruneElements()When 'true', the DOM4J document will not be kept in memory while parsing. | 
| protected  Element | marshal(javax.xml.bind.Element element)Marshals the given Elementin to its DOM4J
 counterpart. | 
|  Document | read(File source)Parses the specified File | 
|  Document | read(File file,
     java.nio.charset.Charset charset)Parses the specified File, using the givenCharset. | 
|  Document | read(InputSource source)Parses the specified InputSource | 
|  Document | read(InputStream source)Parses the specified InputStream | 
|  Document | read(InputStream source,
     String systemId)Parses the specified InputStream | 
|  Document | read(Reader source)Parses the specified Reader | 
|  Document | read(Reader source,
     String systemId)Parses the specified Reader | 
|  Document | read(String source)Parses the the given URL or filename. | 
|  Document | read(URL source)Parses the the given URL. | 
|  void | removeHandler(String path)Removes the ElementHandlerfrom the event based processor,
 for the specified path. | 
|  void | removeObjectHandler(String path)Removes the JAXBObjectHandlerfrom the event based processor, for
 the specified element path. | 
|  void | resetHandlers()Removes all registered JAXBObjectHandlerandElementHandlerinstances from the event based processor. | 
|  void | setPruneElements(boolean pruneElements)Set to true when DOM4J elements must immediately be pruned from the tree. | 
| protected  javax.xml.bind.Element | unmarshal(Element element)Unmarshalls the specified DOM4J Elementinto aElement | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public JAXBReader(String contextPath)
contextPath - context path to be usedJAXBContext
public JAXBReader(String contextPath,
                  ClassLoader classloader)
Classloader. This is the Java package where
 JAXB can find the generated XML classes. This package MUST contain
 jaxb.properties!
contextPath - to be usedclassloader - to be usedJAXBContext| Method Detail | 
public Document read(File source)
              throws DocumentException
File
source - the file to parse
DocumentException - when an error occurs while parsing
public Document read(File file,
                     java.nio.charset.Charset charset)
              throws DocumentException
File, using the given Charset.
file - the file to parsecharset - the charset to be used
DocumentException - when an error occurs while parsing
public Document read(InputSource source)
              throws DocumentException
InputSource
source - the source to parse
DocumentException - when an error occurs while parsing
public Document read(InputStream source)
              throws DocumentException
InputStream
source - the input stream to parse
DocumentException - when an error occurs while parsing
public Document read(InputStream source,
                     String systemId)
              throws DocumentException
InputStream
source - the input stream to parsesystemId - is the URI for the input
DocumentException - when an error occurs while parsing
public Document read(Reader source)
              throws DocumentException
Reader
source - the input reader to use
DocumentException - when an error occurs while parsing
public Document read(Reader source,
                     String systemId)
              throws DocumentException
Reader
source - the input reader to parsesystemId - is the URI for the input
DocumentException - when an error occurs while parsing
public Document read(String source)
              throws DocumentException
source - the location to parse
DocumentException - when an error occurs while parsing
public Document read(URL source)
              throws DocumentException
source - the URL to parse
DocumentException - when an error occurs while parsing
public void addObjectHandler(String path,
                             JAXBObjectHandler handler)
JAXBObjectHandlerthat will be supplied with the
 unmarshalled representation of the xml fragment whenever the specified
 path is encounted.
path - the path to listen forhandler - the handler to be notifiedpublic void removeObjectHandler(String path)
JAXBObjectHandlerfrom the event based processor, for
 the specified element path.
path - The path to remove the JAXBObjectHandlerfor
public void addHandler(String path,
                       ElementHandler handler)
ElementHandler to be called when the specified
 path is encounted.
path - is the path to be handledhandler - is the ElementHandler to be called by the event
            based processor.public void removeHandler(String path)
ElementHandler from the event based processor,
 for the specified path.
path - is the path to remove the ElementHandler for.public void resetHandlers()
JAXBObjectHandlerand ElementHandler instances from the event based processor.
public boolean isPruneElements()
public void setPruneElements(boolean pruneElements)
Documentwill not be available afterwards!
pruneElements - 
protected Element marshal(javax.xml.bind.Element element)
                   throws javax.xml.bind.JAXBException
Elementin to its DOM4J
 counterpart.
element - JAXB Element to be marshalled
Element
javax.xml.bind.JAXBException - when an error occurs
protected javax.xml.bind.Element unmarshal(Element element)
                                    throws javax.xml.bind.JAXBException
Elementinto 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 | ||||||||||