java architecture for xml binding
TRANSCRIPT
![Page 1: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/1.jpg)
Java Architecture for XML Binding (JAXB)
![Page 2: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/2.jpg)
What is JAXB?
![Page 3: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/3.jpg)
MarshallingUnMarshallingAdaptersXSD Annotations
![Page 4: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/4.jpg)
Marshalling
![Page 5: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/5.jpg)
Marshalling
![Page 6: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/6.jpg)
Marshalling
![Page 7: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/7.jpg)
MarshallingConsole output
![Page 8: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/8.jpg)
UnMarshalling
![Page 9: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/9.jpg)
UnMarshallingConsole output
![Page 10: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/10.jpg)
Adapters
Console output
![Page 11: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/11.jpg)
XSD
![Page 12: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/12.jpg)
XSDdata type
![Page 13: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/13.jpg)
XSD
![Page 14: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/14.jpg)
Annotations
@ XmlAccessorOrder @XmlAccessorOrder(XmlAccessOrder.ALPHABETICAL)
@ XmlAccessorType @XmlAccessorType(XmlAccessType.FIELD)
@ XmlAnyAttribute @XmlAnyAttribute public Map<QName, String> getConvertedAttributes()
{ ... }
@ XmlAnyElement@XmlAnyElement(lax = true)
![Page 15: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/15.jpg)
Annotations
@ XmlAttribute @ XmlElement @ XmlElementRef @ XmlElementRefs
@XmlElementWrapper(name = "contacts") @XmlElementRefs({ @XmlElementRef(name = "phone", type = Phone.class, required = true), @XmlElementRef(name = "address", type = Address.class, required = true) }) private final List<ContactInfomation> contacts = new ArrayList<>();
@ XmlElements @ XmlElementWrapper
![Page 16: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/16.jpg)
Annotations
@ XmlEnum
@XmlEnum(Integer.class) public enum Code { @XmlEnumValue("1") ONE, @XmlEnumValue("2") TWO; }_________________________________________
<xs:simpleType name="Code"> <xs:restriction base="xs:int"> <xs:enumeration value="1"/> <xs:enumeration value="2"/> </xs:restriction></xs:simpleType>
@ XmlEnumValue
![Page 17: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/17.jpg)
@ XmlID @XmlID private String id;
_______________________________________<course id="1" name="Fundamentals of Programming"/>
@ XmlList @XmlList
private List<String> emailAddresses;_______________________________________
<emailAddresses>[email protected] [email protected]</emailAddresses>
@ XmlMimeType @XmlMimeType("image/jpeg")
Annotations
![Page 18: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/18.jpg)
@ XmlMixed @ XmlSchema @XmlSchema(namespace = "http://www.example.org/customer") package org.example.customer;
______________________________________<customer xmlns="http://www.example.org/customer">
@ XmlSchemaType @XmlElement(name = "date-of-birth") @XmlSchemaType(name = "date") protected XMLGregorianCalendar dateOfBirth;
______________________________________
<xsd:element name="date-of-birth" type="xsd:date"/>
![Page 19: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/19.jpg)
@ XmlTransient @
XmlRootElement @ XmlType@XmlRootElement@XmlType(propOrder = { "phoneNumbers", "name"})public class Customer extends Person {
private String password; private List<String> phoneNumbers;
@XmlTransient public String getPassword() { return password; }
public void setPassword(String password) {…
<customer><id>123</id><phone-number>555-1111</phone-
number> <phone-number>555-2222</phone-number> <name>Jane Doe</name></customer>
![Page 20: Java architecture for xml binding](https://reader035.vdocument.in/reader035/viewer/2022062300/55cc29c3bb61eb81048b46ab/html5/thumbnails/20.jpg)