![]() ![]() ![]()
|
BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1 |
There are two kinds of XML parsers. One is named "DOM" parser, the another is named "SAX" parser.
The DOM parser expands XML document onto memory as the DOM tree. With the DOM parser, it is very easy to operate an XML document, but usually a lot of memory is needed.
The SAX parser is a set of APIs that read XML document sequentially from the beginning and processes it in an event driven style. It needs less memory and is faster than the DOM parser, but there is no update function for XML documents such as adding, deleting a node etc.
SophiaFramework provides you with SFXXMLDOMParser and SFXXSDDOMParser as the DOM parser, SFXXMLSAXParser as the SAX parser.
The basic functions of SFXXMLDOMParser and SFXXMLSAXParser used by SophiaFramework are as follows.
Table 18.6. Parse
| Function Name of SFXXMLDOMParser class | Function Name of SFXXMLSAXParser class | Description |
|---|---|---|
| SFXXMLDOMParser::Parse | SFXXMLSAXParser::Parse | Function to read and parse XML document. |
Set a parser attribute
Parser attributes are set by using the Set function.
Table 18.7. Function of Setting Parser Attributes
![]() |
caution |
|---|---|
In these SetXXXXXXXXX functions, the attribute value is set to "false" by default except for the SFXXMLDOMParser::SetIgnoreAnnotations / SFXXMLSAXParser::SetIgnoreAnnotations function. | |
Get a parser attribute
Parser attributes can be obtained by using Get functions.
Table 18.8. Function of Getting Parser Attributes
| Function Name of SFXXMLDOMParser class | Function Name of SFXXMLSAXParser class | Description |
|---|---|---|
| SFXXMLDOMParser::GetDoNamespaces | SFXXMLSAXParser::GetDoNamespaces | get the value if namespace should be processed |
| SFXXMLDOMParser::GetDoIndent | SFXXMLSAXParser::GetDoIndent | get the value if statements should be indented |
| SFXXMLDOMParser::GetDoSchema | SFXXMLSAXParser::GetDoSchema | get the value if schema should be processed |
| SFXXMLDOMParser::GetCreateCommentNodes | ------ | get the value if comment node should be created |
| SFXXMLDOMParser::GetValidationSchema | SFXXMLSAXParser::GetValidationSchema | get the value if XML document should be validated by XML Schema |
| SFXXMLDOMParser::GetValidationDTD | SFXXMLSAXParser::GetValidationDTD | get the value if XML document should be validated by DTD |
| SFXXMLDOMParser::GetLoadExternalDTD | SFXXMLSAXParser::GetLoadExternalDTD | get the value if external DTD file of XML document with DTD should be loaded |
| SFXXMLDOMParser::GetIgnoreAnnotations | SFXXMLSAXParser::GetIgnoreAnnotations | get the value if annotation elements file of XML document with XML Schema should be ignored |
| SFXXMLDOMParser::GetDocument | ------ | get the root node of XML tree object document |
Helper function
Table 18.9. Helper function
| Function Name of SFXXMLDOMParser | Description |
|---|---|
| SFXXMLDOMParser::GetFirstChildElement | get the first child node of the node passed as argument |
| SFXXMLDOMParser::GetFirstChildElementNS | get the first child node of the node with namespace passed as argument |
| SFXXMLDOMParser::GetNextSiblingElement | get the next sibling node of the node passed as argument |
| SFXXMLDOMParser::GetNextSiblingElementNS | get the next sibling node of the node with namespace passed as argument |
![]() |
Helper functions |
|---|---|
Only available for SFXXMLDOMParser, not available for SFXXMLSAXParser | |
![]() |
Function of Parsing with SFXXMLSAXParser |
|---|---|
To parse by using SFXXMLSAXParser, it is necessary to inherit the SFXXMLDefaultHandler class for setting a handler interface to notify events. | |
|
Copyright (C) 2002 - 2009 Sophia Cradle, Inc. All Rights Reserved. |
![]() ![]() ![]()
|