XJ: Facilitating XML Processing in Java Matthew Harren Mukund Raghavachari Oded Shmueli Michael Burke Rajesh Bordawekar Igor Pechtchanski Vivek Sarkar Presented By: Tamar Aizikowitz Winter 2006/2007 14th World Wide Web Conference (WWW2005), Chiba, Japan
XJ: Facilitating XML Processing in Java. Presented By: Tamar Aizikowitz Winter 2006/2007. Matthew Harren Mukund Raghavachari Oded Shmueli Michael Burke Rajesh Bordawekar Igor Pechtchanski Vivek Sarkar. 14th World Wide Web Conference (WWW2005), Chiba, Japan. first. John. person. last. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
XJ: Facilitating XML Processing in Java
Matthew HarrenMukund Raghavachari
Oded ShmueliMichael Burke
Rajesh BordawekarIgor Pechtchanski
Vivek Sarkar
Presented By:Tamar Aizikowitz
Winter 2006/2007
14th World Wide Web Conference (WWW2005), Chiba, Japan
2 / 31
XML
Syntax:<person>
<first>John</first><last>Lennon</last>
</person>
Semantics:
Applications: The future web? XHTML? RSS? Problem: Supposedly human readable and
writable, but not really…
person
first
last
John
Lennon
• Markup language• Tags define elements• Elements contain other elements• Elements contain data
3 / 31
XML Schema XML based alternative to DTDs. Describes structure of XML document. Programmer defines valid structure of data by
defining element types. Support for standard and user defined types.
Schema import creates subclasses of XMLElement and XMLAtomic for every element declaration.
XPath expressions evaluated on instances of these classes.
com.ibm.xj.XMLObject
com.ibm.xj.XMLElement
com.ibm.xj.XMLAtomic
All Atomic Classes
All Element Classes
13 / 31
XMLSequence and XMLCursor
Instance of Sequence is ordered list of XMLObject.
XPath expression result is instance of Sequence.
XMLCursor implements java.utils.Iterator. Used to iterate over instances of Sequence.
Support limited genericity (as defined in Java 5.0) for type checking.
java.lang.Object
com.ibm.xj.Sequence
com.ibm.xj.XMLCursor
14 / 31
Importing Schema Definitions
The integration of XML Schema in XJ is built on the following correspondence: XML Schema ~ Java Package XML Element ~ Logical Class Nested (local) Element ~ Nested Class Atomic types ~ Class + Auto Unboxing
15 / 31
Schema ~ Package
Element declarations are integrated into the Java type system as “logical classes”.
XML documents are well typed XML values that are instances of these classes.
Syntax:import musicLibrary.*;
16 / 31
XML Element ~ Class
Elements represented as subclasses of XMLObject.
May be used wherever a class type is expected. Constructed with the new() operator. Nested elements represented as nested classes. Syntax:
musicLibrary ml = new musicLibrary(...);musicLibrary.album a =
new musicLibrary.album(...);
17 / 31
Atomic Types Support for XML Schema built-in atomic types such
as xsd:integer and xsd:string. Represented as subclasses of XMLAtomic. Syntax: xsd.integer Subtyping:xsd.short s = ...;xsd.integer i = s;
Automatic unboxing:xsd.string xstr = ...;string s = xstr;
18 / 31
Creating XML Objects
Mechanisms for constructing XML: External source Literal XML embedded in an XJ program