Как получить инструкцию обработки из XML в программе Xalan? - PullRequest
0 голосов
/ 27 февраля 2012

Я использую Xalan и хочу знать, как получить инструкцию по обработке. Я хочу получить инструкцию по обработке таблицы стилей.

Thnx

1 Ответ

0 голосов
/ 02 марта 2012
        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 :)>
       }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...