|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.x2jb.bind.XML2Java
public final class XML2Java
XML 2 Java Binding core class. It binds DOM elements and documents to Java interfaces. Users use only this class to interact with X2JB runtime.
All methods of this class are thread safe and throw unchecked BindingException on failures. Generated proxies are not thread safe.
Sample usage:
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); // call the following method only when dealing with namespaced document // otherwise never call it builderFactory.setNamespaceAware( true ); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document parsedDocument = builder.parse( new FileInputStream( new File( "config.xml" ) ) ); Config cfg = ( Config ) XML2Java.bind( parsedDocument, Config.class ); // do something with cfg
BindingException
Method Summary | ||
---|---|---|
static
|
bind(org.w3c.dom.Document document,
java.lang.Class<T> iface)
Binds DOM document to Java interface. |
|
static
|
bind(org.w3c.dom.Element element,
java.lang.Class<T> iface)
Binds DOM element to Java interface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T bind(org.w3c.dom.Element element, java.lang.Class<T> iface)
T
- interfaceelement
- DOM element which content will be wrappediface
- interface which instance will be returned
public static <T> T bind(org.w3c.dom.Document document, java.lang.Class<T> iface)
T
- interfacedocument
- DOM document which content will be wrappediface
- interface which instance will be returned
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |