我有一个使用 Xerces-C 作为主要 xml 操作库的 c++ 应用程序。
我有我的 DOMDocument* 和我的解析器,我想设置声明。
我做了以下事情:
parser->setValidationScheme(xercesc::XercesDOMParser::Val_Never);
parser->setDoSchema(false);
parser->setLoadExternalDTD(false);
我要补充:
<?xml-stylesheet type="text/xsl" href="my_xslt.xsl"?>
我该怎么做?
最佳答案
您需要在 DOMDocument 上使用 createProcessingInstruction http://xerces.apache.org/xerces-c/apiDocs-3/classDOMDocument.html#ce898787ba20c00c85be63f28a358507
创建它后,将其附加到 DocumentElement。
关于c++ - 使用 Xerces-C 在我的 xml 中添加样式表声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4747646/