本文整理汇总了C++中XercesDOMParser::setHandleMultipleImports方法的典型用法代码示例。如果您正苦于以下问题:C++ XercesDOMParser::setHandleMultipleImports方法的具体用法?C++ XercesDOMParser::setHandleMultipleImports怎么用?C++ XercesDOMParser::setHandleMultipleImports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XercesDOMParser
的用法示例。
在下文中一共展示了XercesDOMParser::setHandleMultipleImports方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runtime_error
static void
xsdproc (std::string const &schemadir, std::string const &input, std::string const &output)
{
XercesDOMParser parser;
parser.setExternalSchemaLocation ((
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul " + schemadir + "/xul.xsd "
"http://www.w3.org/1999/xhtml " + schemadir + "/xul-html.xsd "
"http://www.w3.org/2000/10/xlink-ns " + schemadir + "/xml/xlink.xsd "
//"http://www.w3.org/2001/SMIL20/ " + schemadir + "/smil/smil20.xsd "
"http://www.w3.org/2001/XInclude " + schemadir + "/xml/xinclude.xsd "
"http://www.w3.org/2002/07/owl# " + schemadir + "/owl/owl.xsd "
"http://www.w3.org/XML/1998/namespace " + schemadir + "/xml/xml.xsd "
).c_str ());
parser.setCreateEntityReferenceNodes (true);
parser.setDoNamespaces (true);
parser.setDoSchema (true);
parser.setDoXInclude (true);
parser.setHandleMultipleImports (true);
parser.setValidationSchemaFullChecking (true);
parser.setValidationScheme (XercesDOMParser::Val_Always);
error_handler handler;
parser.setErrorHandler (&handler);
parser.parse (input.c_str ());
if (handler.failed)
throw std::runtime_error ("validation failed for " + input);
serialise (parser.getDocument (), output);
}
示例2: read
void XMLRuntime::read(const string& filename, FreeAX25::Runtime::Configuration& config) {
XercesDOMParser parser;
parser.setValidationScheme(XercesDOMParser::Val_Always);
parser.setDoNamespaces(true);
parser.setDoSchema(true);
parser.setDoXInclude(true);
parser.setHandleMultipleImports(true);
parser.setValidationSchemaFullChecking(true);
parser.setCreateEntityReferenceNodes(false);
parser.setIncludeIgnorableWhitespace(false);
DOMTreeErrorReporter errReporter;
parser.setErrorHandler(&errReporter);
parser.parse(filename.c_str());
if (errReporter.getSawErrors())
throw exception();
// Now read configuration from the DOM Tree:
XERCES_CPP_NAMESPACE::DOMDocument* doc = parser.getDocument();
assert(doc != nullptr);
auto rootElement = doc->getDocumentElement();
auto configName = rootElement->getAttribute(toX("name"));
config.setId(fmX(configName));
{ // Get settings:
auto nodeList = rootElement->getElementsByTagName(toX("Settings"));
if (nodeList->getLength() > 0)
readSettings(
"",
static_cast<DOMElement*>(nodeList->item(0)),
config.settings);
}
{ // Get plugins:
auto nodeList = rootElement->getElementsByTagName(toX("Plugins"));
if (nodeList->getLength() > 0)
readPlugins(
"",
static_cast<DOMElement*>(nodeList->item(0)),
config.plugins);
}
}
示例3: main
//.........这里部分代码省略.........
}
else if (!strncmp(argV[parmInd], "-xpath=", 7))
{
gXPathExpression = &(argV[parmInd][7]);
}
else
{
XERCES_STD_QUALIFIER cerr << "Unknown option '" << argV[parmInd]
<< "', ignoring it.\n" << XERCES_STD_QUALIFIER endl;
}
}
//
// And now we have to have only one parameter left and it must be
// the file name.
//
if (parmInd + 1 != argC)
{
usage();
XMLPlatformUtils::Terminate();
return 1;
}
gXmlFile = argV[parmInd];
//
// Create our parser, then attach an error handler to the parser.
// The parser will call back to methods of the ErrorHandler if it
// discovers errors during the course of parsing the XML document.
//
XercesDOMParser *parser = new XercesDOMParser;
parser->setValidationScheme(gValScheme);
parser->setDoNamespaces(gDoNamespaces);
parser->setDoSchema(gDoSchema);
parser->setHandleMultipleImports (true);
parser->setValidationSchemaFullChecking(gSchemaFullChecking);
parser->setCreateEntityReferenceNodes(gDoCreate);
DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
parser->setErrorHandler(errReporter);
//
// Parse the XML file, catching any XML exceptions that might propogate
// out of it.
//
bool errorsOccured = false;
try
{
parser->parse(gXmlFile);
}
catch (const OutOfMemoryException&)
{
XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl;
errorsOccured = true;
}
catch (const XMLException& e)
{
XERCES_STD_QUALIFIER cerr << "An error occurred during parsing\n Message: "
<< StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl;
errorsOccured = true;
}
catch (const DOMException& e)
{
const unsigned int maxChars = 2047;
XMLCh errText[maxChars + 1];