Presentation is loading. Please wait.

Presentation is loading. Please wait.

5/3/2004 XMLMap and xsd2java Luigi Zangrando

Similar presentations


Presentation on theme: "5/3/2004 XMLMap and xsd2java Luigi Zangrando"— Presentation transcript:

1 5/3/2004 XMLMap and xsd2java Luigi Zangrando (zangrando@pd.infn.it)INFN-PD

2 5/3/2004Luigi Zangrando APIs for xml parsing DOM2 (Document Object Model): tree representation of the xml doc. SAX2 (Simple API for XML): push parser (event driven xml processing) XMLPull (Common API for XML pull parsing): pull parser (www.xmlpull.org)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 XMLMap unmarshall Java obj XMLMap marshall MAP XML Java obj Serialization Deserialization

3 5/3/2004Luigi Zangrando Example: Unmarshalling 30 mrossi mario.rossi@tin.it mrossi@libero.it : 1 12 23 2 30 32 3 45 51 4 67 75 4 92 108 … User user = new User(); while( map.hasMoreElements( ) ) { int methodIndex = map.nextMethod( ); String value = map.nextValue( ); switch( methodIndex ) { case 1: user.setName( value ); break; case 2: user.setAge( value ); break; : } User obj method index value indexes The map is an array of terns of numbers {(methodIndex, valueStartIndex, valueEndIndex)}

4 5/3/2004Luigi Zangrando SOAP + XMLMap XMLMapJava obj SOAP message Envelope header MAP 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 transport header (requires implementing the SOAP engine)

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

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


Download ppt "5/3/2004 XMLMap and xsd2java Luigi Zangrando"

Similar presentations


Ads by Google