本文整理汇总了C++中DOMParser::setExternalNoNamespaceSchemaLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMParser::setExternalNoNamespaceSchemaLocation方法的具体用法?C++ DOMParser::setExternalNoNamespaceSchemaLocation怎么用?C++ DOMParser::setExternalNoNamespaceSchemaLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMParser
的用法示例。
在下文中一共展示了DOMParser::setExternalNoNamespaceSchemaLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
bool verbose = false;
#if 0
DOMParser::ValSchemes gValScheme = DOMParser::Val_Auto;
bool gDoNamespaces = true;
bool gDoSchema = true;
bool gSchemaFullChecking = false;
bool gDoCreate = false;
#endif
MFileOperations f;
char path[1024];
f.expandPath(path, "MESA_TARGET", "runtime");
::strcat(path, "/IHE-syslog-audit-message-4.xsd");
char* schemaDef = path;
int detailLevel = 1;
MString tmp;
while (--argc > 0 && (*++argv)[0] == '-') {
switch (*(argv[0] + 1)) {
case 'l':
argc--; argv++;
if (argc < 1)
usage();
tmp = *argv;
detailLevel = tmp.intData();
break;
case 's':
argc--; argv++;
if (argc < 1)
usage();
schemaDef = *argv;
break;
case 'v':
verbose = true;
break;
default:
break;
}
}
if (argc < 1)
usage();
// Initialize the XML4C2 system
try {
XMLPlatformUtils::Initialize();
}
catch (const XMLException& e) {
cout << "Unable to initialize Xerces-c software"
<< DOMString(e.getMessage()) << endl;
return 1;
}
DOMParser *parser = new DOMParser;
parser->setValidationScheme(DOMParser::Val_Auto);
parser->setDoNamespaces(true);
parser->setDoSchema(true);
parser->setValidationSchemaFullChecking(true);
if (schemaDef != "") {
parser->setExternalNoNamespaceSchemaLocation(schemaDef);
}
DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
parser->setErrorHandler(errReporter);
parser->setCreateEntityReferenceNodes(false);
parser->setToCreateXMLDeclTypeNode(true);
bool errorFlag = false;
try {
parser->parse(*argv);
int count = parser->getErrorCount();
if (count > 0) {
errorFlag = true;
return 1;
}
}
catch (const XMLException& e) {
cout << "Parsing error: " << DOMString(e.getMessage()) << endl;
return 1;
}
catch (const DOM_DOMException& e) {
cout << "DOM Error: " << e.code << endl;
return 1;
}
catch (...) {
cout << "Unspecified error" << endl;
return 1;
}
DOM_Document doc = parser->getDocument();
unsigned int elementCount = doc.getElementsByTagName("*").getLength();
//.........这里部分代码省略.........