#include <xmlparser.h>
Inheritance diagram for XmlParser:
Public Methods | |
XmlParser (void) | |
A constructor. More... | |
XmlParser (const XmlChar *encoding) | |
A constructor. More... | |
virtual | ~XmlParser (void) |
A destructor. More... | |
virtual long | parse (void) throw (ExaltParserException, ExaltEncodingException, ExaltIOException) |
Parse XML stream. More... | |
virtual long | parsePush (const char *data, int length, bool isFinal) throw (ExaltParserException, ExaltEncodingException, ExaltIOException) |
Parse XML data in PUSH mode. More... | |
virtual void | reportError (void) |
Report parser error messages. More... | |
virtual void | startElement (void *userData, const XmlChar *name, const XmlChar **atts) |
Start element handler. More... | |
virtual void | endElement (void *userData, const XmlChar *name) |
End element handler. More... | |
virtual void | characterData (void *userData, const XmlChar *data, int length) |
Character data handler. More... | |
virtual void | processingInstruction (void *userData, const XmlChar *target, const XmlChar *data) |
Processing instruction handler. More... | |
virtual void | comment (void *userData, const XmlChar *data) |
Comment handler. More... | |
virtual void | startCDATASection (void *userData) |
Start CDATA section handler. More... | |
virtual void | endCDATASection (void *userData) |
End CDATA section handler. More... | |
virtual void | defaultHandler (void *userData, const XmlChar *data, int length) |
Default handler. More... | |
virtual int | unknownEncoding (void *unknownEncodingData, const XmlChar *name, XML_Encoding *info) |
Unknown encoding handler. More... | |
virtual void | xmlDecl (void *userData, const XmlChar *version, const XmlChar *encoding, int standalone) |
XML declaration handler. More... | |
virtual void | startDoctypeDecl (void *userData, const XmlChar *doctypeName, const XmlChar *systemId, const XmlChar *publicId, int hasInternalSubset) |
Start doctype handler. More... | |
virtual void | endDoctypeDecl (void *userData) |
End doctype handler. More... | |
virtual void | entityDecl (void *userData, const XmlChar *entityName, int isParameterEntity, const XmlChar *value, int valueLength, const XmlChar *base, const XmlChar *systemId, const XmlChar *publicId, const XmlChar *notationName) |
Entity declaration handler. More... | |
virtual void | notationDecl (void *userData, const XmlChar *notationName, const XmlChar *base, const XmlChar *systemId, const XmlChar *publicId) |
Notation declaration handler. More... | |
Protected Methods | |
virtual void | initParser (const XmlChar *encoding) |
Initialization of the parser with given encoding. More... | |
void | exposeEvent (XmlModelEvent *ev) |
Expose the XML event to XML model. More... | |
Protected Attributes | |
XmlInnerParser | innerParser |
Expat parser structure. More... | |
char | xmlDataBuff [XML_BUFFER_SIZE] |
unsigned long | charactersTotal |
Total amount of the character data. |
This class is a C++ wrapper around the Expat XML parser. The main task of the parser is (surprisingly) to parse given XML stream and manage all important SAX events. These SAX events are transformed into XML model events (XmlModelEvent) and sent to given XmlModel.
Definition at line 52 of file xmlparser.h.
|
A constructor. Calls initParser(). Definition at line 199 of file xmlparser.cpp. References initParser. |
|
A constructor. Calls initParser().
Definition at line 211 of file xmlparser.cpp. References initParser, and XmlChar. |
|
A destructor. Frees the resources consumed by the parser. Definition at line 271 of file xmlparser.cpp. References charactersTotal, UserOfTextCodec::deleteDefaultTextCodec, ExaltOptions::getOption, innerParser, OUTPUTENL, ExaltOptions::Verbose, and ExaltOptions::Yes. |
|
Character data handler.
Examines the character data and emits an event to the XML model. If the data contain characters &, ', ", < or >, these are substituted by corresponding entities (&, ', ", < or >).
Reimplemented from SAXBase. Definition at line 479 of file xmlparser.cpp. References charactersTotal, exposeEvent, NEW, OUTPUT, and XmlChar. |
|
Comment handler. Sends a corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 531 of file xmlparser.cpp. References exposeEvent, NEW, OUTPUT, and XmlChar. |
|
Default handler. Sends a corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 597 of file xmlparser.cpp. References exposeEvent, NEW, OUTPUT, and XmlChar. |
|
End CDATA section handler. Sends a corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 574 of file xmlparser.cpp. References exposeEvent, NEW, and OUTPUT. |
|
End doctype handler. Sends a corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 751 of file xmlparser.cpp. References exposeEvent, NEW, and OUTPUTNL. |
|
End element handler. Examines the name of the element and emits corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 440 of file xmlparser.cpp. References DELETE_ARRAY, ParseInfo::depth, exposeEvent, NEW, OUTPUT, XmlChar, xmlchar_strcat, xmlchar_strcpy, and xmlchar_strlen. |
|
Entity declaration handler. Sends a corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 780 of file xmlparser.cpp. References exposeEvent, NEW, OUTPUT, and XmlChar. |
|
Expose the XML event to XML model. Sends a XML event to the XML model.
Definition at line 836 of file xmlparser.cpp. References XmlModelBase::manageEvent, WRN, and XmlParserBase::xmlModel. Referenced by characterData, comment, defaultHandler, endCDATASection, endDoctypeDecl, endElement, entityDecl, notationDecl, processingInstruction, startCDATASection, startDoctypeDecl, startElement, and xmlDecl. |
|
Initialization of the parser with given encoding. Initializes the parser (sets the SAX handlers, etc.)
Definition at line 223 of file xmlparser.cpp. References charactersTotal, CHECK_POINTER, innerParser, NEW, ParseInfo::parser, and XmlChar. Referenced by XmlParser. |
|
Notation declaration handler. Sends a corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 812 of file xmlparser.cpp. References exposeEvent, NEW, OUTPUT, and XmlChar. |
|
Parse XML stream. Reads the data from the input device and parses it.
Reimplemented from XmlParserBase. Definition at line 291 of file xmlparser.cpp. References FATAL, ReadOk, and XML_BUFFER_SIZE. Referenced by XmlCodec::encode. |
|
Parse XML data in PUSH mode. Parses given data in the PUSH mode.
Reimplemented from XmlParserBase. Definition at line 345 of file xmlparser.cpp. Referenced by XmlCodec::encodePush. |
|
Processing instruction handler. Examines the description of the processing instruction and emits an event to the XML model.
Reimplemented from SAXBase. Definition at line 507 of file xmlparser.cpp. References exposeEvent, NEW, OUTPUT, and XmlChar. |
|
Report parser error messages. Used for reporting error messages generated by Expat. Reimplemented from SAXBase. Definition at line 375 of file xmlparser.cpp. References innerParser, and PARSERERR. |
|
Start CDATA section handler. Sends a corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 553 of file xmlparser.cpp. References exposeEvent, NEW, and OUTPUT. |
|
Start doctype handler. Sends a corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 726 of file xmlparser.cpp. References exposeEvent, NEW, OUTPUT, and XmlChar. |
|
Start element handler. Examines the name of the element and the values of its attributes and emits corresponding events to the XML model.
Reimplemented from SAXBase. Definition at line 395 of file xmlparser.cpp. References DELETE_ARRAY, ParseInfo::depth, exposeEvent, NEW, OUTPUT, XmlChar, xmlchar_strcat, xmlchar_strcpy, and xmlchar_strlen. |
|
Unknown encoding handler. If there is no text codec specified, the parser creates a default one. The it registers the conversion functions.
Reimplemented from SAXBase. Definition at line 626 of file xmlparser.cpp. References UserOfTextCodec::createDefaultTextCodec, TextCodec::fillInMapArray, TextCodec::getMIB, TextCodec::isAbleToConvert, EncodingInfo::mib, NEW, OUTPUT, EncodingInfo::textCodec, UserOfTextCodec::textCodec, and XmlChar. |
|
XML declaration handler. Sends a corresponding event to the XML model.
Reimplemented from SAXBase. Definition at line 697 of file xmlparser.cpp. References exposeEvent, NEW, OUTPUT, and XmlChar. |
|
Expat parser structure.
This is the "heart" of the class, which realizes the main part of the SAX parsing. All SAX events emitted by innerParser are redirected to handlers of the class. Definition at line 154 of file xmlparser.h. Referenced by initParser, reportError, and ~XmlParser. |
|
Buffer for XML data. Data coming from the XML stream are stored in this buffer. If the size of the data is larger than XML_BUFFER_SIZE, the parsing is done in more blocks. Definition at line 161 of file xmlparser.h. |