5/3/2004 XMLMap and xsd2java Luigi Zangrando
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 ( 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
5/3/2004Luigi Zangrando Example: Unmarshalling 30 mrossi : … 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)}
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/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
5/3/2004Luigi Zangrando Performance test XMLMap is 10 times faster than SAX2 Test description: each parser must unmarshall times a simple XML document composed of 11 elements.