< prev index next >
src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2005, 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) 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
*** 55,87 ****
* as {@link Element}. (Assumes property annotated with @XmlAnyElement)</li>
* </ul>
*
* Below is an example of binding and creation of mixed content.
* <pre>
! * <!-- schema fragment having mixed content -->
! * <xs:complexType name="letterBody" mixed="true">
! * <xs:sequence>
! * <xs:element name="name" type="xs:string"/>
! * <xs:element name="quantity" type="xs:positiveInteger"/>
! * <xs:element name="productName" type="xs:string"/>
! * <!-- etc. -->
! * </xs:sequence>
! * </xs:complexType>
! * <xs:element name="letterBody" type="letterBody"/>
*
* // Schema-derived Java code:
* // (Only annotations relevant to mixed content are shown below,
* // others are ommitted.)
* import java.math.BigInteger;
* public class ObjectFactory {
* // element instance factories
! * JAXBElement<LetterBody> createLetterBody(LetterBody value);
! * JAXBElement<String> createLetterBodyName(String value);
! * JAXBElement<BigInteger> createLetterBodyQuantity(BigInteger value);
! * JAXBElement<String> createLetterBodyProductName(String value);
* // type instance factory
! * LetterBody> createLetterBody();
* }
* </pre>
* <pre>
* public class LetterBody {
* // Mixed content can contain instances of Element classes
--- 55,87 ----
* as {@link Element}. (Assumes property annotated with @XmlAnyElement)</li>
* </ul>
*
* Below is an example of binding and creation of mixed content.
* <pre>
! * <!-- schema fragment having mixed content -->
! * <xs:complexType name="letterBody" mixed="true">
! * <xs:sequence>
! * <xs:element name="name" type="xs:string"/>
! * <xs:element name="quantity" type="xs:positiveInteger"/>
! * <xs:element name="productName" type="xs:string"/>
! * <!-- etc. -->
! * </xs:sequence>
! * </xs:complexType>
! * <xs:element name="letterBody" type="letterBody"/>
*
* // Schema-derived Java code:
* // (Only annotations relevant to mixed content are shown below,
* // others are ommitted.)
* import java.math.BigInteger;
* public class ObjectFactory {
* // element instance factories
! * JAXBElement<LetterBody> createLetterBody(LetterBody value);
! * JAXBElement<String> createLetterBodyName(String value);
! * JAXBElement<BigInteger> createLetterBodyQuantity(BigInteger value);
! * JAXBElement<String> createLetterBodyProductName(String value);
* // type instance factory
! * LetterBody createLetterBody();
* }
* </pre>
* <pre>
* public class LetterBody {
* // Mixed content can contain instances of Element classes
*** 95,114 ****
* List getContent(){...}
* }
* </pre>
* The following is an XML instance document with mixed content
* <pre>
! * <letterBody>
! * Dear Mr.<name>Robert Smith</name>
! * Your order of <quantity>1</quantity> <productName>Baby
! * Monitor</productName> shipped from our warehouse. ....
! * </letterBody>
* </pre>
* that can be constructed using following JAXB API calls.
* <pre>
* LetterBody lb = ObjectFactory.createLetterBody();
! * JAXBElement<LetterBody> lbe = ObjectFactory.createLetterBody(lb);
* List gcl = lb.getContent(); //add mixed content to general content property.
* gcl.add("Dear Mr."); // add text information item as a String.
*
* // add child element information item
* gcl.add(ObjectFactory.createLetterBodyName("Robert Smith"));
--- 95,114 ----
* List getContent(){...}
* }
* </pre>
* The following is an XML instance document with mixed content
* <pre>
! * <letterBody>
! * Dear Mr.<name>Robert Smith</name>
! * Your order of <quantity>1</quantity> <productName>Baby
! * Monitor</productName> shipped from our warehouse. ....
! * </letterBody>
* </pre>
* that can be constructed using following JAXB API calls.
* <pre>
* LetterBody lb = ObjectFactory.createLetterBody();
! * JAXBElement<LetterBody> lbe = ObjectFactory.createLetterBody(lb);
* List gcl = lb.getContent(); //add mixed content to general content property.
* gcl.add("Dear Mr."); // add text information item as a String.
*
* // add child element information item
* gcl.add(ObjectFactory.createLetterBodyName("Robert Smith"));
< prev index next >