/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.xml.bind;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.bind.attachment.AttachmentUnmarshaller;
import javax.xml.validation.Schema;
import java.io.Reader;
/**
* The <tt>Unmarshaller</tt> class governs the process of deserializing XML
* data into newly created Java content trees, optionally validating the XML
* data as it is unmarshalled. It provides an overloading of unmarshal methods
* for many different input kinds.
*
* <p>
* Unmarshalling from a File:
* <blockquote>
* <pre>
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
* Unmarshaller u = jc.createUnmarshaller();
* Object o = u.unmarshal( new File( "nosferatu.xml" ) );
* </pre>
* </blockquote>
*
*
* <p>
* Unmarshalling from an InputStream:
* <blockquote>
* <pre>
* InputStream is = new FileInputStream( "nosferatu.xml" );
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
* Unmarshaller u = jc.createUnmarshaller();
* Object o = u.unmarshal( is );
* </pre>
* </blockquote>
*
* <p>
* Unmarshalling from a URL:
* <blockquote>
* <pre>
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
* Unmarshaller u = jc.createUnmarshaller();
* URL url = new URL( "http://beaker.east/nosferatu.xml" );
* Object o = u.unmarshal( url );
* </pre>
* </blockquote>
*
* <p>
* Unmarshalling from a StringBuffer using a
* <tt>javax.xml.transform.stream.StreamSource</tt>:
* <blockquote>
* <pre>
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
* Unmarshaller u = jc.createUnmarshaller();
* StringBuffer xmlStr = new StringBuffer( "<?xml version="1.0"?>..." );
* Object o = u.unmarshal( new StreamSource( new StringReader( xmlStr.toString() ) ) );
* </pre>
* </blockquote>
*
* <p>
* Unmarshalling from a <tt>org.w3c.dom.Node</tt>:
* <blockquote>
* <pre>
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
* Unmarshaller u = jc.createUnmarshaller();
*
* DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
* dbf.setNamespaceAware(true);
* DocumentBuilder db = dbf.newDocumentBuilder();
* Document doc = db.parse(new File( "nosferatu.xml"));
* Object o = u.unmarshal( doc );
* </pre>
* </blockquote>
*
* <p>
* Unmarshalling from a <tt>javax.xml.transform.sax.SAXSource</tt> using a
* client specified validating SAX2.0 parser:
* <blockquote>
* <pre>
* // configure a validating SAX2.0 parser (Xerces2)
* static final String JAXP_SCHEMA_LANGUAGE =
* "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
* static final String JAXP_SCHEMA_LOCATION =
* "http://java.sun.com/xml/jaxp/properties/schemaSource";
* static final String W3C_XML_SCHEMA =
* "http://www.w3.org/2001/XMLSchema";
*
* System.setProperty( "javax.xml.parsers.SAXParserFactory",
* "org.apache.xerces.jaxp.SAXParserFactoryImpl" );
*
* SAXParserFactory spf = SAXParserFactory.newInstance();
* spf.setNamespaceAware(true);
* spf.setValidating(true);
* SAXParser saxParser = spf.newSAXParser();
*
=1= |