71 * <pre> |
71 * <pre> |
72 * //Example: Code fragment corresponding to XML output |
72 * //Example: Code fragment corresponding to XML output |
73 * marshal( new Point(3,5), System.out); |
73 * marshal( new Point(3,5), System.out); |
74 * </pre> |
74 * </pre> |
75 * |
75 * |
76 * <pre> |
76 * <pre>{@code |
77 * <!-- Example: XML output --> |
77 * |
78 * <point> |
78 * <!-- Example: XML output --> |
79 * <x> 3 </x> |
79 * <point> |
80 * <y> 5 </y> |
80 * <x> 3 </x> |
81 * </point> |
81 * <y> 5 </y> |
82 * </pre> |
82 * </point> |
|
83 * }</pre> |
83 * |
84 * |
84 * The annotation causes an global element declaration to be produced |
85 * The annotation causes an global element declaration to be produced |
85 * in the schema. The global element declaration is associated with |
86 * in the schema. The global element declaration is associated with |
86 * the XML schema type to which the class is mapped. |
87 * the XML schema type to which the class is mapped. |
87 * |
88 * |
88 * <pre> |
89 * <pre>{@code |
89 * <!-- Example: XML schema definition --> |
90 * |
90 * <xs:element name="point" type="point"/> |
91 * <!-- Example: XML schema definition --> |
91 * <xs:complexType name="point"> |
92 * <xs:element name="point" type="point"/> |
92 * <xs:sequence> |
93 * <xs:complexType name="point"> |
93 * <xs:element name="x" type="xs:int"/> |
94 * <xs:sequence> |
94 * <xs:element name="y" type="xs:int"/> |
95 * <xs:element name="x" type="xs:int"/> |
95 * </xs:sequence> |
96 * <xs:element name="y" type="xs:int"/> |
96 * </xs:complexType> |
97 * </xs:sequence> |
97 * </pre> |
98 * </xs:complexType> |
|
99 * }</pre> |
98 * |
100 * |
99 * <p> |
101 * <p> |
100 * |
102 * |
101 * <b>Example 2: Orthogonality to type inheritance </b> |
103 * <b>Example 2: Orthogonality to type inheritance </b> |
102 * |
104 * |
111 * Point3D(int _x,int _y,int _z) {super(_x,_y);z=_z;} |
113 * Point3D(int _x,int _y,int _z) {super(_x,_y);z=_z;} |
112 * } |
114 * } |
113 * |
115 * |
114 * //Example: Code fragment corresponding to XML output * |
116 * //Example: Code fragment corresponding to XML output * |
115 * marshal( new Point3D(3,5,0), System.out ); |
117 * marshal( new Point3D(3,5,0), System.out ); |
|
118 * {@code |
116 * |
119 * |
117 * <!-- Example: XML output --> |
120 * <!-- Example: XML output --> |
118 * <!-- The element name is point3D not point --> |
121 * <!-- The element name is point3D not point --> |
119 * <point3D> |
122 * <point3D> |
120 * <x>3</x> |
123 * <x>3</x> |
121 * <y>5</y> |
124 * <y>5</y> |
122 * <z>0</z> |
125 * <z>0</z> |
123 * </point3D> |
126 * </point3D> |
124 * |
127 * |
125 * <!-- Example: XML schema definition --> |
128 * <!-- Example: XML schema definition --> |
126 * <xs:element name="point3D" type="point3D"/> |
129 * <xs:element name="point3D" type="point3D"/> |
127 * <xs:complexType name="point3D"> |
130 * <xs:complexType name="point3D"> |
128 * <xs:complexContent> |
131 * <xs:complexContent> |
129 * <xs:extension base="point"> |
132 * <xs:extension base="point"> |
130 * <xs:sequence> |
133 * <xs:sequence> |
131 * <xs:element name="z" type="xs:int"/> |
134 * <xs:element name="z" type="xs:int"/> |
132 * </xs:sequence> |
135 * </xs:sequence> |
133 * </xs:extension> |
136 * </xs:extension> |
134 * </xs:complexContent> |
137 * </xs:complexContent> |
135 * </xs:complexType> |
138 * </xs:complexType> |
136 * </pre> |
139 * }</pre> |
137 * |
140 * |
138 * <b>Example 3: </b> Associate a global element with XML Schema type |
141 * <b>Example 3: </b> Associate a global element with XML Schema type |
139 * to which the class is mapped. |
142 * to which the class is mapped. |
140 * <pre> |
143 * <pre> |
141 * //Example: Code fragment |
144 * //Example: Code fragment |
142 * @XmlRootElement(name="PriceElement") |
145 * @XmlRootElement(name="PriceElement") |
143 * public class USPrice { |
146 * public class USPrice { |
144 * @XmlElement |
147 * @XmlElement |
145 * public java.math.BigDecimal price; |
148 * public java.math.BigDecimal price; |
146 * } |
149 * } |
|
150 * {@code |
147 * |
151 * |
148 * <!-- Example: XML schema definition --> |
152 * <!-- Example: XML schema definition --> |
149 * <xs:element name="PriceElement" type="USPrice"/> |
153 * <xs:element name="PriceElement" type="USPrice"/> |
150 * <xs:complexType name="USPrice"> |
154 * <xs:complexType name="USPrice"> |
151 * <xs:sequence> |
155 * <xs:sequence> |
152 * <xs:element name="price" type="xs:decimal"/> |
156 * <xs:element name="price" type="xs:decimal"/> |
153 * </sequence> |
157 * </sequence> |
154 * </xs:complexType> |
158 * </xs:complexType> |
155 * </pre> |
159 * }</pre> |
156 * |
160 * |
157 * @author Sekhar Vajjhala, Sun Microsystems, Inc. |
161 * @author Sekhar Vajjhala, Sun Microsystems, Inc. |
158 * @since 1.6, JAXB 2.0 |
162 * @since 1.6, JAXB 2.0 |
159 */ |
163 */ |
160 @Retention(RUNTIME) |
164 @Retention(RUNTIME) |