JAXB Overview Vladimir Gapeyev.

Slides:



Advertisements
Similar presentations
1 Web Data Management XML Schema. 2 In this lecture XML Schemas Elements v. Types Regular expressions Expressive power Resources W3C Draft:
Advertisements

1 XML DTD & XML Schema Monica Farrow G30
The Java Architecture For XML Binding (JAXB) By: Yoav Zibin Sharon Krisher.
JAXB Java Architecture for XML Binding Andy Fanton Khalid AlBayat.
A Simple Schema Design. First Schema Design Being a Dog Is a Full-Time Job Charles M. Schulz Snoopy Peppermint Patty extroverted beagle Peppermint.
Fonts and colors Times New Roman “quotes” Trebuchet "quotes" yellow blue pink green violet.
XML Schemas. “Schemas” is a general term--DTDs are a form of XML schemas –According to the dictionary, a schema is “a structured framework or plan” When.
Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti.
29-Jun-15 JAXB Java Architecture for XML Binding.
JAXB Java Architecture for XML Bindings. What is JAXB? JAXB defines the behavior of a standard set of tools and interfaces that automatically generate.
Web Services with Apache CXF Part 2: JAXB and WSDL to Java Robert Thornton.
AIXM Viewer Implementation Presentation to AIXM Users’ Conference, Federal Aviation Administration, Washington D.C., Feb 27-March 1, By: Mark Austin,
JXON An Architecture for Schema and Annotation Driven JSON/XML Bidirectional Transformations David A. Lee Senior Principal Software Engineer Slide 1.
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
XML Schema Vinod Kumar Kayartaya. What is XML Schema?  XML Schema is an XML based alternative to DTD  An XML schema describes the structure of an XML.
CSE4500 Information Retrieval Systems XML Schema – Part 1.
Agenda Introduction to MDHT MDHT Capabilities MDHT support using Consolidated CDA 1.
Compiling Mappings to Bridge Applications and Databases Melnik, Adya and Research.
Sheet 1XML Technology in E-Commerce 2001Lecture 7 XML Technology in E-Commerce Lecture 7 XSL Formatting Objects, Java Data Binding.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation XML Schema 2 Lecturer.
Of 33 lecture 3: xml and xml schema. of 33 XML, RDF, RDF Schema overview XML – simple introduction and XML Schema RDF – basics, language RDF Schema –
Web Services with Apache CXF Part 2: JAXB and WSDL to Java Robert Thornton.
XML and Validation Tools Schema Schematron. XML eXtensible Markup Language (XML) –A metamarkup language. –The basic unit is called an element –Fairly.
 XML DTD and XML Schema Discussion Sessions 1A and 1B Session 2.
Web 310 XML Schema : What You Need to Know and Why Yasser Shohoud Program Manager XML Messaging Microsoft Corporation.
Sheet 1 DocEng’03, Grenoble, November 2003 Model Driven Architecture based XML Processing Ivan Kurtev, Klaas van den Berg University of Twente, the Netherlands.
Web Services with Apache CXF Part 2: JAXB and WSDL to Java Robert Thornton.
XML Schema. Why Validate XML? XML documents can generally have any structure XML grammars define specific document structures Validation is the act of.
EGEE is a project funded by the European Union under contract IST XML Schema 3 – 4 June
CS 157B: Database Management Systems II February 18 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
Foundational Data Modeling and Schema Transformations for XML Data Engineering Stephen W. Liddle Information Systems Department Reema Al-Kamha & David.
QUALITY CONTROL WITH SCHEMAS CSC1310 Fall BASIS CONCEPTS SchemaSchema is a pass-or-fail test for document Schema is a minimum set of requirements.
Introduction to XML Schema John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel: (x2073)
XSD: XML Schema Language Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
All Presentation Material Copyright Eurostep Group AB ® A Meta-model of EXPRESS in UML for MOF and UML to EXPRESS David Price April 2002.
Loader Tutorial. Set Up Mapping Coding Scheme Values to LexGrid Model Creating a Loader – Step by Step Loader Review.
Presentation: Advanced AXIS: Deployment Descriptors and Advanced Types.
XJ: Facilitating XML Processing in Java Matthew Harren Mukund Raghavachari Oded Shmueli Michael Burke Rajesh Bordawekar Igor Pechtchanski Vivek Sarkar.
JAXB (Java Architecture for XML Binding) Internet Computing KUT ( Youn-Hee Han.
CITA 330 Section 4 XML Schema. XML Schema (XSD) An alternative industry standard for defining XML dialects More expressive than DTD Using XML syntax Promoting.
4 Copyright © 2004, Oracle. All rights reserved. Validating XML by Using XML Schema.
XML DTDs and Schemas How we define our markup language.
The Java API for XML Binding. The Need for Data Binding To support unmarshlling to convert XML data into Java objects. To support marshalling to convert.
XML: Extensible Markup Language
Chapter 8 Environments, Alternatives, and Decisions.
Sixth Lecture ArrayList Abstract Class and Interface
XML Schema.
ACG 4401 XML Schemas XML Namespaces XLink.
ACG 4401 XML Schemas XML Namespaces XLink.
Web Services-JAX-RPC JAX-RPC enables a Web Service endpoint to be developed using either a Java Servlet or Enterprise JavaBeans (EJB) component model.
Systems Analysis and Design With UML 2
CMP 051 XML Introduction Session IV
Lecture 9 XML & its applications
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
ISSGC’05 XML Schemas (XSD)
دانشكده مهندسي كامپيوتر
Inheritance Basics Programming with Inheritance
Design and Implementation of Software for the Web
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
Classes & Objects: Examples
CMP 051 XML Introduction Session IV Chapter 10 – Defining Simple Types
DTD and XML Schema.
Computer Programming with JAVA
CMP 051 XML Introduction Session III
Lecture 9 XML & its applications
XML In Action With Oracle
XML Schema Diyar A. Abdulqder
Presentation transcript:

JAXB Overview Vladimir Gapeyev

XML data binding Java: XML: ObjectFactory f = <book> new ObjectFactory(); Book b = f.createBook(); b.setTitle(“Compilers”); List a = b.getAuthor(); a.add(“Aho”); a.add(“Sethi”); a.add(“Ullman”); b.setPages(796); <book> <title>Compilers</title> <author>Aho</author> <author>Sethi</author> <author>Ullman</author> <pages>796</pages> </book> 12/5/2018 JAXB Overview

Schema-based XML data binding compile Schema Classes instance of conforms unmarshal Objects Documents marshal 12/5/2018 JAXB Overview

JAXB: Java Architecture for XML Binding Specification: Subset of XML Schema Default bindings XML names  Java names Schema atomic types  predefined Java types Schema structured types  Java interfaces javax.xml.bind – framework interfaces Language for binding customization Reference implementation: Schema-to-Java compliler Generates classes as well 12/5/2018 JAXB Overview

Mapping for atomic types xs:string  java.lang.string xs:decimal java.math.BigDecimal xs:int int xs:QName javax.xml.namespace.QName xs:date java.util.Calendar Etc… 12/5/2018 JAXB Overview

Elements with simple content interface Zip extends javax.xml.bind.Element { int getValue(); void setValue(int); } <xs:element name=“zip” type=“xs:int” /> 12/5/2018 JAXB Overview

Elements with sequence and repetition <xs:element name=“book” > <xs:ComplexType> <xs:sequence> <xs:element name=“title” type=“xs:string”/> <xs:element name=“author” type=“xs:string” maxOccurs=“unbounded”/> <xs:element name=“pages” type=“xs:int”/> </xs:sequence> </xs:ComplexType> </xs:element> interface Book extends BookType, javax.xml.bind.Element {} interface BookType { String getTitile(); void setTitle(String x); List getAuthor(); int getPages(); void setPages(int x); } 12/5/2018 JAXB Overview

Elements with choice <xs:complexType name=“volume”> <xs:choice> <xs:element ref=“book”/> ref=“journal”/> </xs:choice> </xs:complexType> interface Volume { BookType getBook(); void setBook(BookType); JournalType getJournal(); void setJournal(JournalType); } 12/5/2018 JAXB Overview

Customization: isSet() method <xs:annotation><xs:appinfo> <jxb:globalBindings generateIsSetMethod=“true"/> </xs:appinfo></xs:annotation> <xs:complexType name=“volume”> <xs:choice> <xs:element ref=“book”/> ref=“journal”/> </xs:choice> </xs:complexType> interface Volume { BookType getBook(); void setBook(BookType); boolean isSetBook(); JournalType getJournal(); void setJournal(JournalType); boolean isSetJournal(); } 12/5/2018 JAXB Overview

No roundtripping interface T { type t { getA(); setA(); getB(); setB(); } type t { (element a, element b) | (element b, element a) } Type t members: <a/><b/> and <b/><a/> unmarshal; marshal =/= identity unmarshal; marshal; unmarshal = unmarshal 12/5/2018 JAXB Overview

“General content style” <xs:complexType name=“t”> <xs:choice maxOccurs=“unbounded”> <element ref=“book”/> <element ref=“journal”/> </xs:choice> </xs:complexType> interface T { List getBookOrJournal() } Plus a constraint: The only list members are Book objects Journal objects 12/5/2018 JAXB Overview

Model groups, by default <xs:group name="bookName"> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="author" type="xs:string“/> </xs:sequence> </xs:group> <xs:complexType name="bookType"> <xs:group ref="bookName"/> <xs:element name="pages" type="xs:int"/> </xs:complexType> interface BookType { String getTitle(); void setTitle(String x); String getAuthor(); void setAuthor(String); int getPages(); void setPages(int x); } 12/5/2018 JAXB Overview

Model groups, customized <xs:group name="bookName"> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="author" type="xs:string“/> </xs:sequence> </xs:group> <xs:complexType name="bookType"> <xs:group ref="bookName"/> <xs:element name="pages" type="xs:int"/> </xs:complexType> interface BookName { String getTitle(); void setTitle(String x); String getAuthor(); void setAuthor(String); } interface BookType { BookName getBookName(); void setBookName(BookName); int getPages(); void setPages(int x); 12/5/2018 JAXB Overview

Summary of observations Mapping often loses static typing information – need to employ dynamic constraints Complex content models with choice are most problematic Alternative mapping styles No good declarative specifications for the mappings 12/5/2018 JAXB Overview

Opportunities Formal specification of mapping styles Formulate desired mapping properties Verify that the mapping styles enjoy the properties A toolkit for generating mapping compilers (as opposed to a single compiler) 12/5/2018 JAXB Overview