jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java
changeset 29839 6d5d546e953b
parent 28887 88470f768658
child 32795 5a5710ee05a0
equal deleted inserted replaced
29838:fe5fd9871a13 29839:6d5d546e953b
    63  *     class ObjectFactory {
    63  *     class ObjectFactory {
    64  *         @XmlElementDecl(name="foo")
    64  *         @XmlElementDecl(name="foo")
    65  *         JAXBElement<String> createFoo(String s) { ... }
    65  *         JAXBElement<String> createFoo(String s) { ... }
    66  *     }
    66  *     }
    67  * </pre>
    67  * </pre>
    68  * <pre>
    68  * <pre> {@code
    69  *     &lt;!-- XML input --&gt;
    69  *
    70  *       &lt;foo&gt;string&lt;/foo&gt;
    70  *     <!-- XML input -->
       
    71  *     <foo>string</foo>
    71  *
    72  *
    72  *     // Example: code fragment corresponding to XML input
    73  *     // Example: code fragment corresponding to XML input
    73  *     JAXBElement&lt;String&gt; o =
    74  *     JAXBElement<String> o =
    74  *     (JAXBElement&lt;String&gt;)unmarshaller.unmarshal(aboveDocument);
    75  *     (JAXBElement<String>)unmarshaller.unmarshal(aboveDocument);
    75  *     // print JAXBElement instance to show values
    76  *     // print JAXBElement instance to show values
    76  *     System.out.println(o.getName());   // prints  "{}foo"
    77  *     System.out.println(o.getName());   // prints  "{}foo"
    77  *     System.out.println(o.getValue());  // prints  "string"
    78  *     System.out.println(o.getValue());  // prints  "string"
    78  *     System.out.println(o.getValue().getClass()); // prints "java.lang.String"
    79  *     System.out.println(o.getValue().getClass()); // prints "java.lang.String"
    79  *
    80  *
    80  *     &lt;!-- Example: XML schema definition --&gt;
    81  *     <!-- Example: XML schema definition -->
    81  *     &lt;xs:element name="foo" type="xs:string"/&gt;
    82  *     <xs:element name="foo" type="xs:string"/>
    82  * </pre>
    83  * }</pre>
    83  *
    84  *
    84  * <p><b>Example 2: </b> Element declaration with non local scope
    85  * <p><b>Example 2: </b> Element declaration with non local scope
    85  * <p>
    86  * <p>
    86  * The following example illustrates the use of scope annotation
    87  * The following example illustrates the use of scope annotation
    87  * parameter in binding of element declaration in schema derived
    88  * parameter in binding of element declaration in schema derived
    88  * code.
    89  * code.
    89  * <p>
    90  * <p>
    90  * The following example may be replaced in a future revision of
    91  * The following example may be replaced in a future revision of
    91  * this javadoc.
    92  * this javadoc.
    92  *
    93  *
    93  * <pre>
    94  * <pre>{@code
    94  *     &lt;!-- Example: XML schema definition --&gt;
    95  *     <!-- Example: XML schema definition -->
    95  *     &lt;xs:schema&gt;
    96  *     <xs:schema>
    96  *       &lt;xs:complexType name="pea"&gt;
    97  *       <xs:complexType name="pea">
    97  *         &lt;xs:choice maxOccurs="unbounded"&gt;
    98  *         <xs:choice maxOccurs="unbounded">
    98  *           &lt;xs:element name="foo" type="xs:string"/&gt;
    99  *           <xs:element name="foo" type="xs:string"/>
    99  *           &lt;xs:element name="bar" type="xs:string"/&gt;
   100  *           <xs:element name="bar" type="xs:string"/>
   100  *         &lt;/xs:choice&gt;
   101  *         </xs:choice>
   101  *       &lt;/xs:complexType&gt;
   102  *       </xs:complexType>
   102  *       &lt;xs:element name="foo" type="xs:int"/&gt;
   103  *       <xs:element name="foo" type="xs:int"/>
   103  *     &lt;/xs:schema&gt;
   104  *     </xs:schema>
   104  * </pre>
   105  * }</pre>
   105  * <pre>
   106  * <pre>
   106  *     // Example: expected default binding
   107  *     // Example: expected default binding
   107  *     class Pea {
   108  *     class Pea {
   108  *         &#64;XmlElementRefs({
   109  *         &#64;XmlElementRefs({
   109  *             &#64;XmlElementRef(name="foo",type=JAXBElement.class)
   110  *             &#64;XmlElementRef(name="foo",type=JAXBElement.class)