XMLMap and xsd 2 java Luigi Zangrando zangrandopd

  • Slides: 6
Download presentation
XMLMap and xsd 2 java Luigi Zangrando (zangrando@pd. infn. it) INFN-PD 5/3/2004

XMLMap and xsd 2 java Luigi Zangrando (zangrando@pd. infn. it) INFN-PD 5/3/2004

APIs for xml parsing DOM 2 (Document Object Model): tree representation of the xml

APIs for xml parsing DOM 2 (Document Object Model): tree representation of the xml doc. SAX 2 (Simple API for XML): push parser (event driven xml processing) XMLPull (Common API for XML pull parsing): pull parser (www. xmlpull. org) XMLMap: provides a direct way for accessing xml values using a special mapping. The main goal is to achieve high performance. MAP XML Deserialization XMLMap unmarshall Serialization Java obj 5/3/2004 XMLMap marshall Luigi Zangrando Java obj MAP XML

Example: Unmarshalling method index value indexes 1 12 23 2 30 32 3 45

Example: Unmarshalling method index value indexes 1 12 23 2 30 32 3 45 51 4 67 75 4 92 108 … <user name=“Mario Rossi”> <age>30</age> <login>mrossi</login> <e-mail>mario. rossi@tin. it</e-mail> <e-mail>mrossi@libero. it</e-mail> : </user> User user = new User(); while( map. has. More. Elements( ) ) { int method. Index = map. next. Method( ); String value = map. next. Value( ); switch( method. Index ) { case 1: user. set. Name( value ); break; case 2: user. set. Age( value ); break; : } User obj } The map is an array of terns of numbers {(method. Index, value. Start. Index, value. End. Index)} 5/3/2004 Luigi Zangrando

SOAP + XMLMap SOAP message Envelope header MAP XMLMap Java obj body XML Note:

SOAP + XMLMap SOAP message Envelope header MAP XMLMap Java obj body XML Note: alternatively we could insert the MAP information into the HTTP header Note: XMLMap could be also used to parse SOAP msgs exploiting a map in the 5/3/2004 Luigi Zangrando transport header (requires implementing the SOAP engine)

xsd 2 java (alpha) It is a toll that generates Java source code from

xsd 2 java (alpha) It is a toll that generates Java source code from a xsd schema. XSD xsd 2 java Java code xsd 2 java provides a dual engine for xml parsing: XMLMap when a MAP is associated to the xml document, XMLPull otherwise. MAP XML xsd 2 java XMLMap XML 5/3/2004 XMLPull Luigi Zangrando Java obj

Performance test Test description: each parser must unmarshall 10000 times a simple XML document

Performance test Test description: each parser must unmarshall 10000 times a simple XML document composed of 11 elements. XMLMap is 10 times faster than SAX 2 5/3/2004 Luigi Zangrando