Download FAQ History |  | API Search Feedback

> ## Representing XML Content

> This section describes how JAXB represents XML content as Java objects. Specifically, the topics in this section are as follows:

> - Binding XML Names to Java Identifiers
> - Java Representation of XML Schema

> ### Binding XML Names to Java Identifiers

> XML schema languages use XML names--strings that match the Name production defined in XML 1.0 (Second Edition) (`http://www.w3.org/XML/`) to label schema components. This set of strings is much larger than the set of valid Java class, method, and constant identifiers. To resolve this discrepancy, JAXB uses several name-mapping algorithms.

> The JAXB name-mapping algorithm maps XML names to Java identifiers in a way that adheres to standard Java API design guidelines, generates identifiers that retain obvious connections to the corresponding schema, and is unlikely to result in many collisions.

> Refer to Chapter 11 for information about changing default XML name mappings. See Appendix C in the JAXB Specification for complete details about the JAXB naming algorithm.

> ### Java Representation of XML Schema

> JAXB supports the grouping of generated classes and interfaces in Java packages. A package comprises:

> - A name, which is either derived directly from the XML namespace URI, or specified by a binding customization of the XML namespace URI
> - A set of Java content interfaces representing the content models declared within the schema
> - A Set of Java element interfaces representing element declarations occurring within the schema
> - An `ObjectFactory` class containing:
> - An instance factory method for each Java content interface and Java element interface within the package; for example, given a Java content interface named `Foo`, the derived factory method would be:

>         public Foo createFoo() throws JAXBException;

> - Dynamic instance factory allocator; creates an instance of the specified Java content interface; for example:

>              public Object newInstance(Class javaContentInterface)
>              throws JAXBException;

> - `getProperty` and `setProperty` APIs that allow the manipulation of provider-specified properties
> - Set of typesafe enum classes
> - Package javadoc

Download FAQ History |  | API Search Feedback

All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.