glyn 02/05/13 08:12:10 Modified: java/docs architecture-guide.html messagemodelclasses.jpg Added: java/docs SAXHandlerClasses.jpg SAXhandlers.jpg Log: Describe DeserializationContextImpl and related classes used to build SAX parse trees. Revision Changes Path 1.12 +45 -8 xml-axis/java/docs/architecture-guide.html Index: architecture-guide.html =================================================================== RCS file: /home/cvs/xml-axis/java/docs/architecture-guide.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- architecture-guide.html 10 Apr 2002 11:13:45 -0000 1.11 +++ architecture-guide.html 13 May 2002 15:12:10 -0000 1.12 @@ -24,7 +24,7 @@ Axis Architecture Guide</h1> <font face="Lucida Sans"><font color="#CC0000"><font size=+3>Under construction ....</font></font></font> -<br><i>Beta 1 Version</i> +<br><i>Post-Beta 2 Version</i> <br><i>Feedback: <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a></i> <h3> Contents</h3> @@ -39,6 +39,7 @@ <br><a href="#Message Model Subsystem">Message Model Subsystem</a> <br> <a href="#SOAP message model">SOAP Message Model</a> <br> <a href="#Message elements">Message Elements</a> +<br> <a href="#D13n">Deserialization</a> <br><a href="#Encoding Subsystem">Encoding Subsystem</a> <br><a href="#WSDL Subsystem">WSDL Tools Subsystem</a> <br> <a href="#WSDL2Java">WSDL2Java</a> @@ -284,9 +285,8 @@ The following diagram shows the classes and the types of runtime artefacts they produce (a dotted arrow means "instantiates"). <br><img SRC="wsddclasses.jpg"> -<h2> -<a NAME="Message Model Subsystem"></a>Message Model Subsystem</h2> -<a name="SOAP message model"></a><h3>SOAP Message Model</h3> +<h2><a NAME="Message Model Subsystem"></a>Message Model Subsystem</h2> +<h3><a name="SOAP message model"></a>SOAP Message Model</h3> The XML syntax of a SOAP message is fairly simple. A SOAP message consists of an <i>envelope</i> containing: <ul> @@ -314,15 +314,52 @@ So the SOAP message model looks like this: <br><img SRC="soapmessagemodel.jpg"> -<a name="Message elements"></a><h3>Message Elements</h3> -The classes which represent SOAP messages form a hierarchy based on +<h3><a name="Message elements"></a>Message Elements</h3> +The classes which represent SOAP messages form a class hierarchy based on the MessageElement class which takes care of namespaces and encodings. The SOAPHeaderElement class looks after the actor and mustUnderstand attributes. <br><img SRC="messagemodelclasses.jpg"> -<h2> -<a NAME="Encoding Subsystem"></a>Encoding Subsystem</h2> +During deserialization, a parse tree is constructed consisting of instances +of the above classes in parent-child relationships as shown below. +<br><img SRC="messagetree.jpg"> +<h3><a name="D13n"></a>Deserialization</h3> +The class mainly responsible for XML parsing, i.e. deserialization, is +DeserializationContextImpl ('DCI') which inherits most of its methods from the +DeserializationContext interface. +DCI manages the construction of the parse tree and +maintains a stack of SAX handlers, a reference to the MessageElement that +is currently being deserialized, a stack of namespace mappings, and a SAX event +recorder. +<p>The SAX handlers form a class hierarchy: +<br><img SRC="SAXHandlerClasses.jpg"> +<p>and stack up as shown in the following diagram: +<br><img SRC="SAXhandlers.jpg"> +<p>Initially, the SAX handler stack just contains an instance of +EnvelopeHandler which represents the fact that parsing of the SOAP envelope +has not yet started. +The EnvelopeHandler is constructed with a reference to an EnvelopeBuilder, +which is the SAX handler responsible for parsing the SOAP envelope. +<p>During parsing, DCI receives the events from the +SAX parser and notifies either the SAX handler on the top of its handler +stack, the SAX event recorder, or both. +<p>On the start of an element, DCI calls the SAX handler +on the top of its handler stack for onStartChild. This method returns a +SAX handler to be used to parse the child, which DCI +pushes on its SAX handler stack and calls for startElement. +startElement, amongst other things, typically creates a new MessageElement +of the appropriate class and calls DCI +for pushNewElement. +The latter action creates the parent-child relationships of the parse tree. +<p>On the end of an element, DCI pops the top SAX handler +from its handler stack and calls it for endElement. It then drives SAX +handler which is now on the top of the handler stack for onEndChild. +Finally, it sets the MessageElement that is currently being deserialized to +the parent of the current one. +<p>Elements which are not defined by SOAP are treated using a SOAPHandler +as a SAX event handler and a MessageElement as a node in the parse tree. +<h2><a NAME="Encoding Subsystem"></a>Encoding Subsystem</h2> Encoding is most easily understood from the bottom up. The basic requirement is to transform between values of programming language datatypes and their XML representations. In Axis, this means 1.5 +177 -140 xml-axis/java/docs/messagemodelclasses.jpg <<Binary file>> 1.1 xml-axis/java/docs/SAXHandlerClasses.jpg <<Binary file>> 1.1 xml-axis/java/docs/SAXhandlers.jpg <<Binary file>>