![]() ![]() ![]()
|
BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1 |
DTD and XML Schema are the grammars to validate whether a XML document is correctly formated when being parsed by a XML parser.
In DTD, data type cannot be defined, and its grammar is not described in XML.
In XML Schema, the syntax is described in XML format, features such as data type definition and namespace handling that not included in DTD are available.
SophiaFramework supports DTD and XML Schema. When DTD or XML Schema is used to parse a XML document, if there is some data that is not regulated by the grammar, error will occur.
Furthermore, when parsing a WSDL document, the XML Schema is prerequisite.
The processing of a XML document with DTD uses the following functions of SFXXMLDOMParser/SFXXMLSAXParser
Table 18.10. Function of processing XML documents with DTD
| Purpose | Function Name of SFXXMLDOMParser class | Function Name of SFXXMLSAXParser class |
|---|---|---|
| Verify XML document by DTD | SFXXMLDOMParser::SetValidationDTD | SFXXMLSAXParser::SetValidationDTD |
| Load extended DTD file into XML document with DTD | SFXXMLDOMParser::SetLoadExternalDTD | SFXXMLSAXParser::SetLoadExternalDTD |
![]() |
Function of Loading External DTD File |
|---|---|
If DTD is defined as a separate file with the XML document, SetLoadExternalDTD is set to true and DTD file is loaded. | |
The following operations can be used to get a SFXXMLDocumentType object from the XML tree object.
Table 18.11. Function of Processing DTD file
| Function Name | Description |
|---|---|
| GetEntities | get all the entities declared in DTD |
| GetNotations | get all the notations declared in DTD |
| GetPublicID | get the public ID of an external subset |
| GetSystemID | get the system ID of an external subset |
When processing XML documents with XML Schema, use the following functions of SFXXSDDOMParser or SFXXMLSAXParser class
Table 18.12. Function of Processing XML Documents with XML Schema
| Purpose | Function Name of SFXXMLDOMParser class | Function Name of SFXXMLSAXParser class |
|---|---|---|
| Proccess XML schema | SFXXMLDOMParser::SetDoSchema | SFXXMLSAXParser::SetDoSchema |
| Verify XML document by XML schema | SFXXMLDOMParser::SetValidationSchema | SFXXMLSAXParser::SetValidationSchema |
| Invalidate Annotation element of XML document with XML Schema | SFXXMLDOMParser::SetIgnoreAnnotations | SFXXMLSAXParser::SetIgnoreAnnotations |
| Specify the XSD file of the XML document with XML Schema | SFXXMLDOMParser::SetSchemaLocation | SFXXMLSAXParser::SetSchemaLocation |
![]() |
Function of Setting Namespace |
|---|---|
If SetDoNamespaces is "true", namespace can be set. | |
|
Copyright (C) 2002 - 2008 Sophia Cradle, Inc. All Rights Reserved. |
![]() ![]() ![]()
|