< prev index next >

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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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

@@ -48,22 +48,21 @@
  * single value JavaBean property. During unmarshalling, each xml element
  * that does not match a static @XmlElement or @XmlElementRef
  * annotation for the other JavaBean properties on the class, is added to this
  * "catch-all" property.
  *
- * <p>
  * <h2>Usages:</h2>
  * <pre>
  * @XmlAnyElement
  * public {@link Element}[] others;
  *
  * // Collection of {@link Element} or JAXB elements.
  * @XmlAnyElement(lax="true")
  * public {@link Object}[] others;
  *
  * @XmlAnyElement
- * private List&lt;{@link Element}> nodes;
+ * private List&lt;{@link Element}&gt; nodes;
  *
  * @XmlAnyElement
  * private {@link Element} node;
  * </pre>
  *

@@ -86,61 +85,61 @@
  * <p>
  * This annotation can be used with {@link XmlMixed} like this:
  * <pre>
  * // List of java.lang.String or DOM nodes.
  * @XmlAnyElement @XmlMixed
- * List&lt;Object> others;
+ * List&lt;Object&gt; others;
  * </pre>
  *
  *
  * <h2>Schema To Java example</h2>
  *
  * The following schema would produce the following Java class:
  * <pre>
- * &lt;xs:complexType name="foo">
- *   &lt;xs:sequence>
- *     &lt;xs:element name="a" type="xs:int" />
- *     &lt;xs:element name="b" type="xs:int" />
- *     &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- *   &lt;/xs:sequence>
- * &lt;/xs:complexType>
+ * &lt;xs:complexType name="foo"&gt;
+ *   &lt;xs:sequence&gt;
+ *     &lt;xs:element name="a" type="xs:int" /&gt;
+ *     &lt;xs:element name="b" type="xs:int" /&gt;
+ *     &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /&gt;
+ *   &lt;/xs:sequence&gt;
+ * &lt;/xs:complexType&gt;
  * </pre>
  *
  * <pre>
  * class Foo {
  *   int a;
  *   int b;
  *   @{@link XmlAnyElement}
- *   List&lt;Element> any;
+ *   List&lt;Element&gt; any;
  * }
  * </pre>
  *
  * It can unmarshal instances like
  *
  * <pre>
- * &lt;foo xmlns:e="extra">
- *   &lt;a>1</a>
- *   &lt;e:other />  // this will be bound to DOM, because unmarshalling is orderless
- *   &lt;b>3</b>
- *   &lt;e:other />
- *   &lt;c>5</c>     // this will be bound to DOM, because the annotation doesn't remember namespaces.
- * &lt;/foo>
+ * &lt;foo xmlns:e="extra"&gt;
+ *   &lt;a&gt;1&lt;/a&gt;
+ *   &lt;e:other /&gt;  // this will be bound to DOM, because unmarshalling is orderless
+ *   &lt;b&gt;3&lt;/b&gt;
+ *   &lt;e:other /&gt;
+ *   &lt;c&gt;5&lt;/c&gt;     // this will be bound to DOM, because the annotation doesn't remember namespaces.
+ * &lt;/foo&gt;
  * </pre>
  *
  *
  *
  * The following schema would produce the following Java class:
  * <pre>
- * &lt;xs:complexType name="bar">
- *   &lt;xs:complexContent>
- *   &lt;xs:extension base="foo">
- *     &lt;xs:sequence>
- *       &lt;xs:element name="c" type="xs:int" />
- *       &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- *     &lt;/xs:sequence>
- *   &lt;/xs:extension>
- * &lt;/xs:complexType>
+ * &lt;xs:complexType name="bar"&gt;
+ *   &lt;xs:complexContent&gt;
+ *   &lt;xs:extension base="foo"&gt;
+ *     &lt;xs:sequence&gt;
+ *       &lt;xs:element name="c" type="xs:int" /&gt;
+ *       &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /&gt;
+ *     &lt;/xs:sequence&gt;
+ *   &lt;/xs:extension&gt;
+ * &lt;/xs:complexType&gt;
  * </pre>
  *
  * <pre>
  * class Bar extends Foo {
  *   int c;

@@ -150,18 +149,18 @@
  *
  *
  * It can unmarshal instances like
  *
  * <pre>
- * &lt;bar xmlns:e="extra">
- *   &lt;a>1</a>
- *   &lt;e:other />  // this will be bound to DOM, because unmarshalling is orderless
- *   &lt;b>3</b>
- *   &lt;e:other />
- *   &lt;c>5</c>     // this now goes to Bar.c
- *   &lt;e:other />  // this will go to Foo.any
- * &lt;/bar>
+ * &lt;bar xmlns:e="extra"&gt;
+ *   &lt;a&gt;1&lt;/a&gt;
+ *   &lt;e:other /&gt;  // this will be bound to DOM, because unmarshalling is orderless
+ *   &lt;b&gt;3&lt;/b&gt;
+ *   &lt;e:other /&gt;
+ *   &lt;c&gt;5&lt;/c&gt;     // this now goes to Bar.c
+ *   &lt;e:other /&gt;  // this will go to Foo.any
+ * &lt;/bar&gt;
  * </pre>
  *
  *
  *
  *

@@ -171,47 +170,47 @@
  * designate additional elements that can participate in the content tree.
  *
  * <p>
  * The following schema would produce the following Java class:
  * <pre>
- * &lt;xs:complexType name="foo">
- *   &lt;xs:choice maxOccurs="unbounded" minOccurs="0">
- *     &lt;xs:element name="a" type="xs:int" />
- *     &lt;xs:element name="b" type="xs:int" />
- *     &lt;xs:any namespace="##other" processContents="lax" />
- *   &lt;/xs:choice>
- * &lt;/xs:complexType>
+ * &lt;xs:complexType name="foo"&gt;
+ *   &lt;xs:choice maxOccurs="unbounded" minOccurs="0"&gt;
+ *     &lt;xs:element name="a" type="xs:int" /&gt;
+ *     &lt;xs:element name="b" type="xs:int" /&gt;
+ *     &lt;xs:any namespace="##other" processContents="lax" /&gt;
+ *   &lt;/xs:choice&gt;
+ * &lt;/xs:complexType&gt;
  * </pre>
  *
  * <pre>
  * class Foo {
  *   @{@link XmlAnyElement}(lax="true")
  *   @{@link XmlElementRefs}({
  *     @{@link XmlElementRef}(name="a", type="JAXBElement.class")
  *     @{@link XmlElementRef}(name="b", type="JAXBElement.class")
  *   })
- *   {@link List}&lt;{@link Object}> others;
+ *   {@link List}&lt;{@link Object}&gt; others;
  * }
  *
  * @XmlRegistry
  * class ObjectFactory {
  *   ...
  *   @XmlElementDecl(name = "a", namespace = "", scope = Foo.class)
- *   {@link JAXBElement}&lt;Integer> createFooA( Integer i ) { ... }
+ *   {@link JAXBElement}&lt;Integer&gt; createFooA( Integer i ) { ... }
  *
  *   @XmlElementDecl(name = "b", namespace = "", scope = Foo.class)
- *   {@link JAXBElement}&lt;Integer> createFooB( Integer i ) { ... }
+ *   {@link JAXBElement}&lt;Integer&gt; createFooB( Integer i ) { ... }
  * </pre>
  *
  * It can unmarshal instances like
  *
  * <pre>
- * &lt;foo xmlns:e="extra">
- *   &lt;a>1</a>     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
- *   &lt;e:other />  // this will unmarshal to a DOM {@link Element}.
- *   &lt;b>3</b>     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
- * &lt;/foo>
+ * &lt;foo xmlns:e="extra"&gt;
+ *   &lt;a&gt;1&lt;/a&gt;     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
+ *   &lt;e:other /&gt;  // this will unmarshal to a DOM {@link Element}.
+ *   &lt;b&gt;3&lt;/b&gt;     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
+ * &lt;/foo&gt;
  * </pre>
  *
  *
  *
  *

@@ -225,14 +224,14 @@
  *   public {@link Object}[] others;
  * }
  * </pre>
  * then the following document will unmarshal like this:
  * <pre>
- * &lt;foo>
- *   &lt;unknown />
- *   &lt;foo />
- * &lt;/foo>
+ * &lt;foo&gt;
+ *   &lt;unknown /&gt;
+ *   &lt;foo /&gt;
+ * &lt;/foo&gt;
  *
  * Foo foo = unmarshal();
  * // 1 for 'unknown', another for 'foo'
  * assert foo.others.length==2;
  * // 'unknown' unmarshals to a DOM element
< prev index next >