< prev index next >

src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 52,62 **** * as XML element in an XML document. * * <p> This annotation can be used with the following annotations: * {@link XmlType}, {@link XmlEnum}, {@link XmlAccessorType}, * {@link XmlAccessorOrder}. ! * <p> * <p> * <b>Example 1: </b> Associate an element with XML Schema type * <pre> * // Example: Code fragment --- 52,62 ---- * as XML element in an XML document. * * <p> This annotation can be used with the following annotations: * {@link XmlType}, {@link XmlEnum}, {@link XmlAccessorType}, * {@link XmlAccessorOrder}. ! * </p> * <p> * <b>Example 1: </b> Associate an element with XML Schema type * <pre> * // Example: Code fragment
*** 72,101 **** * //Example: Code fragment corresponding to XML output * marshal( new Point(3,5), System.out); * </pre> * * <pre> ! * &lt;!-- Example: XML output --> ! * &lt;point> ! * &lt;x> 3 </x> ! * &lt;y> 5 </y> ! * &lt;/point> * </pre> * * The annotation causes an global element declaration to be produced * in the schema. The global element declaration is associated with * the XML schema type to which the class is mapped. * * <pre> ! * &lt;!-- Example: XML schema definition --> ! * &lt;xs:element name="point" type="point"/> ! * &lt;xs:complexType name="point"> ! * &lt;xs:sequence> ! * &lt;xs:element name="x" type="xs:int"/> ! * &lt;xs:element name="y" type="xs:int"/> ! * &lt;/xs:sequence> ! * &lt;/xs:complexType> * </pre> * * <p> * * <b>Example 2: Orthogonality to type inheritance </b> --- 72,101 ---- * //Example: Code fragment corresponding to XML output * marshal( new Point(3,5), System.out); * </pre> * * <pre> ! * &lt;!-- Example: XML output --&gt; ! * &lt;point&gt; ! * &lt;x&gt; 3 &lt;/x&gt; ! * &lt;y&gt; 5 &lt;/y&gt; ! * &lt;/point&gt; * </pre> * * The annotation causes an global element declaration to be produced * in the schema. The global element declaration is associated with * the XML schema type to which the class is mapped. * * <pre> ! * &lt;!-- Example: XML schema definition --&gt; ! * &lt;xs:element name="point" type="point"/&gt; ! * &lt;xs:complexType name="point"&gt; ! * &lt;xs:sequence&gt; ! * &lt;xs:element name="x" type="xs:int"/&gt; ! * &lt;xs:element name="y" type="xs:int"/&gt; ! * &lt;/xs:sequence&gt; ! * &lt;/xs:complexType&gt; * </pre> * * <p> * * <b>Example 2: Orthogonality to type inheritance </b>
*** 112,140 **** * } * * //Example: Code fragment corresponding to XML output * * marshal( new Point3D(3,5,0), System.out ); * ! * &lt;!-- Example: XML output --> ! * &lt;!-- The element name is point3D not point --> ! * &lt;point3D> ! * &lt;x>3&lt;/x> ! * &lt;y>5&lt;/y> ! * &lt;z>0&lt;/z> ! * &lt;/point3D> ! * ! * &lt;!-- Example: XML schema definition --> ! * &lt;xs:element name="point3D" type="point3D"/> ! * &lt;xs:complexType name="point3D"> ! * &lt;xs:complexContent> ! * &lt;xs:extension base="point"> ! * &lt;xs:sequence> ! * &lt;xs:element name="z" type="xs:int"/> ! * &lt;/xs:sequence> ! * &lt;/xs:extension> ! * &lt;/xs:complexContent> ! * &lt;/xs:complexType> * </pre> * * <b>Example 3: </b> Associate a global element with XML Schema type * to which the class is mapped. * <pre> --- 112,140 ---- * } * * //Example: Code fragment corresponding to XML output * * marshal( new Point3D(3,5,0), System.out ); * ! * &lt;!-- Example: XML output --&gt; ! * &lt;!-- The element name is point3D not point --&gt; ! * &lt;point3D&gt; ! * &lt;x&gt;3&lt;/x&gt; ! * &lt;y&gt;5&lt;/y&gt; ! * &lt;z&gt;0&lt;/z&gt; ! * &lt;/point3D&gt; ! * ! * &lt;!-- Example: XML schema definition --&gt; ! * &lt;xs:element name="point3D" type="point3D"/&gt; ! * &lt;xs:complexType name="point3D"&gt; ! * &lt;xs:complexContent&gt; ! * &lt;xs:extension base="point"&gt; ! * &lt;xs:sequence&gt; ! * &lt;xs:element name="z" type="xs:int"/&gt; ! * &lt;/xs:sequence&gt; ! * &lt;/xs:extension&gt; ! * &lt;/xs:complexContent&gt; ! * &lt;/xs:complexType&gt; * </pre> * * <b>Example 3: </b> Associate a global element with XML Schema type * to which the class is mapped. * <pre>
*** 143,159 **** * public class USPrice { * @XmlElement * public java.math.BigDecimal price; * } * ! * &lt;!-- Example: XML schema definition --> ! * &lt;xs:element name="PriceElement" type="USPrice"/> ! * &lt;xs:complexType name="USPrice"> ! * &lt;xs:sequence> ! * &lt;xs:element name="price" type="xs:decimal"/> ! * &lt;/sequence> ! * &lt;/xs:complexType> * </pre> * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @since 1.6, JAXB 2.0 */ --- 143,159 ---- * public class USPrice { * @XmlElement * public java.math.BigDecimal price; * } * ! * &lt;!-- Example: XML schema definition --&gt; ! * &lt;xs:element name="PriceElement" type="USPrice"/&gt; ! * &lt;xs:complexType name="USPrice"&gt; ! * &lt;xs:sequence&gt; ! * &lt;xs:element name="price" type="xs:decimal"/&gt; ! * &lt;/sequence&gt; ! * &lt;/xs:complexType&gt; * </pre> * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @since 1.6, JAXB 2.0 */
< prev index next >