Как получить инструкцию обработки из XML в программе Xalan?
Я использую Xalan и хочу знать, как получить инструкцию по обработке. Я хочу получить инструкцию по обработке таблицы стилей.
Thnx
1 ответ
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 :)>
}