com.basilv.examples.jaxb
Class XmlBindingTools
java.lang.Object
com.basilv.examples.jaxb.XmlBindingTools
public class XmlBindingTools
- extends Object
Tools for working with the JAXB (XML Binding) library.
|
Method Summary |
static void |
generateXML(Object rootElement,
Writer writer)
Generate XML using the supplied root element as the
root of the object tree and write the resulting XML to
the specified writer |
static
|
parseXML(Reader reader,
Class<E> rootElementClass)
Parse the XML supplied by the reader into the
corresponding tree of Java objects. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XmlBindingTools
public XmlBindingTools()
parseXML
public static <E> E parseXML(Reader reader,
Class<E> rootElementClass)
throws JAXBException
- Parse the XML supplied by the reader into the
corresponding tree of Java objects.
- Parameters:
reader - Cannot be null. The source of the XML.rootElementClass - Cannot be null. The type of the
root element.
- Returns:
- the Java object that is the root of the tree,
of type rootElement.
- Throws:
JAXBException - if an error occurs parsing the
XML.
generateXML
public static void generateXML(Object rootElement,
Writer writer)
throws JAXBException
- Generate XML using the supplied root element as the
root of the object tree and write the resulting XML to
the specified writer
- Parameters:
rootElement - Cannot be null.writer - Cannot be null.
- Throws:
JAXBException
Java Examples available from http://www.basilv.com/psd/software Copyright © 2009 by Basil Vandegriend. All Rights Reserved.