Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Xerces getXML method

Xerces getXML method

Scheduled Pinned Locked Moved XML / XSL
questionjavahtmlxmlhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 4 Offline
    4 Offline
    4apai
    wrote on last edited by
    #1

    ladies & gentlemen. i'm new in xerces xml dom. can anyone help me with following: how can i get the XML content of the DOMDocument (as in msxml)? there methods like, getTextContent... but it returns text without tags. i've seen that java implemantation of xerces has DOMSerializer object. maybe there is any analogical object... any ideas? 4apai There're no impossible tasks. There're tasks that required infinite period of execution time.

    C 1 Reply Last reply
    0
    • 4 4apai

      ladies & gentlemen. i'm new in xerces xml dom. can anyone help me with following: how can i get the XML content of the DOMDocument (as in msxml)? there methods like, getTextContent... but it returns text without tags. i've seen that java implemantation of xerces has DOMSerializer object. maybe there is any analogical object... any ideas? 4apai There're no impossible tasks. There're tasks that required infinite period of execution time.

      C Offline
      C Offline
      crazzycat
      wrote on last edited by
      #2

      int main(int argc, char **argv) { int errorCount = 0; try { XMLPlatformUtils::Initialize(); } catch(const XMLException& toCatch) { cout << "XMLPlatformUtils::Initialize() failed." << endl; XMLPlatformUtils::Terminate(); } std::auto_ptr pXercesDOMParser(new XercesDOMParser()); std::auto_ptr errReporter(new myDOMTreeErrorReporter()); pXercesDOMParser->setErrorHandler(errReporter.get()); XercesDOMParser::ValSchemes valScheme = XercesDOMParser::Val_Auto; pXercesDOMParser->setValidationScheme(valScheme); try { char filename[] = "config/command.xml"; pXercesDOMParser->parse(filename); errorCount = pXercesDOMParser->getErrorCount(); if (errorCount > 0) { cout << "open file failed. 0" << endl; XMLPlatformUtils::Terminate(); //goto Exit; return 0; } } catch (const DOMException& e) { cout << "open file failed. 1" << endl; XMLPlatformUtils::Terminate(); return 0; } catch (const XMLException& e) { cout << "open file failed. 2" << endl; XMLPlatformUtils::Terminate(); return 0; } DOMNode *pDOC = pXercesDOMParser->getDocument(); DOMNode *pNode = pDOC->getFirstChild(); //std::string name(getProp(pNode, "?xml")); for (pNode = getNextElementNode(pNode); pNode != NULL; pNode = getNextElementNode(pNode)) { /*if (!UtilXML::matchNode(pNode, "dictionary"); if (!matchNode(pNode, "dictionary")) { cout << "Bad dictionary format." << endl; break; } std::string proto(getProp(pNode, "protocol")); int currentProtocol = atol(proto.c_str()); #ifdef _DEBUG cout << "protocol = " << currentProtocol << endl; #endif parseDictionary(pNode->getFirstChild(), currentProtocol); */ if(!matchNode(pNode, "command")) { cout << "Bad command format." << endl; break; } parseCommand(pNode, 0); } //Exit: pXercesDOMParser.release(); errReporter.release(); XMLPlatformUtils::Terminate(); return 0; }

      4 1 Reply Last reply
      0
      • C crazzycat

        int main(int argc, char **argv) { int errorCount = 0; try { XMLPlatformUtils::Initialize(); } catch(const XMLException& toCatch) { cout << "XMLPlatformUtils::Initialize() failed." << endl; XMLPlatformUtils::Terminate(); } std::auto_ptr pXercesDOMParser(new XercesDOMParser()); std::auto_ptr errReporter(new myDOMTreeErrorReporter()); pXercesDOMParser->setErrorHandler(errReporter.get()); XercesDOMParser::ValSchemes valScheme = XercesDOMParser::Val_Auto; pXercesDOMParser->setValidationScheme(valScheme); try { char filename[] = "config/command.xml"; pXercesDOMParser->parse(filename); errorCount = pXercesDOMParser->getErrorCount(); if (errorCount > 0) { cout << "open file failed. 0" << endl; XMLPlatformUtils::Terminate(); //goto Exit; return 0; } } catch (const DOMException& e) { cout << "open file failed. 1" << endl; XMLPlatformUtils::Terminate(); return 0; } catch (const XMLException& e) { cout << "open file failed. 2" << endl; XMLPlatformUtils::Terminate(); return 0; } DOMNode *pDOC = pXercesDOMParser->getDocument(); DOMNode *pNode = pDOC->getFirstChild(); //std::string name(getProp(pNode, "?xml")); for (pNode = getNextElementNode(pNode); pNode != NULL; pNode = getNextElementNode(pNode)) { /*if (!UtilXML::matchNode(pNode, "dictionary"); if (!matchNode(pNode, "dictionary")) { cout << "Bad dictionary format." << endl; break; } std::string proto(getProp(pNode, "protocol")); int currentProtocol = atol(proto.c_str()); #ifdef _DEBUG cout << "protocol = " << currentProtocol << endl; #endif parseDictionary(pNode->getFirstChild(), currentProtocol); */ if(!matchNode(pNode, "command")) { cout << "Bad command format." << endl; break; } parseCommand(pNode, 0); } //Exit: pXercesDOMParser.release(); errReporter.release(); XMLPlatformUtils::Terminate(); return 0; }

        4 Offline
        4 Offline
        4apai
        wrote on last edited by
        #3

        thx a lot. thats not really what i meant. but i find it helpful too. 4apai There're no impossible tasks. There're tasks that required infinite period of execution time.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups