我正在使用Xalan并想知道如何获得处理指令。 我想获得样式表处理指令。
日Thnx
答案 0 :(得分:0)
XMLPlatformUtils::Initialize();
XPathEvaluator::initialize();
{
const XalanDOMString theFileName(fileName);
const LocalFileInputSource theInputSource(theFileName.c_str());
XalanSourceTreeInit theSourceTreeInit;
XalanSourceTreeDOMSupport theDOMSupport;
XalanSourceTreeParserLiaison theLiaison(theDOMSupport);
theDOMSupport.setParserLiaison(&theLiaison);
XalanDocument* const theDocument =
theLiaison.parseXMLStream(theInputSource);
if(!theDocument) {
std::cerr << "Failed to create XalanDocument" << std::endl;
retValue = -1;
}
XalanDocumentPrefixResolver thePrefixResolver(theDocument);
XPathEvaluator theEvaluator;
XalanNode* const rootContextNode = theEvaluator.selectSingleNode(
theDOMSupport, theDocument,
XalanDOMString("/processing-instruction('xml-stylesheet')").c_str(),
thePrefixResolver);
if(rootContextNode) {
//<Now do whatever u want :)>
}