Dear Wiki user, You have subscribed to a wiki page or wiki category on "Ws Wiki" for change notification.
The following page has been changed by GeoffWinn: http://wiki.apache.org/ws/Tuscany/TuscanyCpp/DesignNotes ------------------------------------------------------------------------------ This call is forwarding the event reported by libxml2 to a method within a parser object created by SDO. - To understand this, we have to step back a little. A client of libxml2 initiates the parse of an XML instance by calling the xmlSAXUserParseFile function. This function takes three parameters. The first is the struct containing the list of callback functions (ie SDOSAX2``Handler) and the third is the name of the XML file to parse. The second parameter is of type '''void*''' and is not used by libxml2 directly. However, it is passed to every callback functon that libxml2 calls as part of this parse to spply them with whatever context information it represents. In Tucant SDO that context is in fact a pointer to an object that implements the appropriate parsing of the file. + To understand this, we have to step back a little. A client of libxml2 initiates the parse of an XML instance by calling the xmlSAX``User``Parse``File() function. This function takes three parameters. The first is the struct containing the list of callback functions (ie SDOSAX2``Handler) and the third is the name of the XML file to parse. The second parameter is of type '''void*''' and is not used by libxml2 directly. However, it is passed to every callback functon that libxml2 calls as part of this parse to supply them with whatever context information it represents. In Tuscany SDO that context is in fact a pointer to an object that implements the appropriate parsing of the file and these objects are instances of one of two classes, both of which are derived from a common base. The base class is SAX2``Parser, and that defines virtual methods to handle events returned by libxml2. (In fact it defines methods for that subset of the events that SDO will use.) The two concrete classes are SDOSAX2``Parser and SDOSchemaSAX2``Parser. The former is used when parsing XML instance documents and the latter when parsing XML Schema Definitions. Both classes re-implement the methods that process SAX events to handle them in the appropriate way for either XML or XSD. - To watch the parsing of a file as it unfolds it is usually easiest to place breakpoints on the routines named in that struct. + Therefore, the overall process for parsing an XML or XSD input document and generating the corresponding data object or meta data structures in SDO as follows. + + 1. Create an instance of SDOSAX2``Parser for parsing XML instance documents or an instance of SDOSchemaSAX2``Parser for parsing an XSD document. + + 2. Pass the address of the SAX2``Parser object just created to libxml2 as the context parameter of the xmlSAX``User``Parse``File() function. + + 3. As the parse unfolds, libxml2 will use the SDOSAX2``Handler struct to call the callback function that is appropriate for each event that it is reporting. These will be C functions in SAX2``Parser.cpp + + 4. Many of those functions will simply return having done nothing because SDO has no interest in that particular event. However, when a SAX event is of interest, the C callback function will use the context parameter that libxml2 has supplied to it (ie the address of a SAX2``Parser object) to call the method on that object that corresponds to the current SAX event. + + Simple. + + To watch the parsing of a file as it unfolds there are three broad options. If the file is an XSD then place breakpoints on the methods of SDOSchemaSAX2``Parser. If it is an XML instance then set breakpoints on the methods of SDOSAX2``Parser. If it could be either, then place breakpoints on the C functions that are named in SDOSAX2``Handler and that are found in SAX2``Parser.cpp = Modifying the SDO Build to use the Apache stdcxx Standard C++ library = --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]