Menu

need help about tiXmlText

tewis
2005-09-28
2013-05-20
  • tewis

    tewis - 2005-09-28

    Hi !
    I am trying to get a text in a element. I use dev-cpp 4.9.9.2 and tinyxml 2.3.4.

    test.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <SCTemplate>name</SCTemplate>

    test.cpp:
        TiXmlDocument doc;
        doc.LoadFile("test.xml");

    TiXmlNode *node= doc.RootElement();
        if(node->ToElement())
            printf("value:%s\n",node->Value());

    node = node->FirstChild();
        if(node->ToText())
            printf("value:%s\n",node->Value());

    stdout:
    value:SCTemplate
    value:

    I am becoming crazy! help me plz ^^
    thx

     
    • Yves Berquin

      Yves Berquin - 2005-09-28

      Your code is correct, and gives the right results here.
      Something must be wrong with your setup.
      You open the file on the local directory : are you sure you read the right file ?

      Yves

       
    • tewis

      tewis - 2005-09-28

      i added doc.Print(stdout);

      stdout:
      <?xml version="1.0" encoding="UTF-8"?>
      <SCTemplate>name</SCTemplate>
      value:SCTemplate
      value:

      i don't want go back to libxml or xerces /cry

      PS: xmltest.cpp works ==> pass 104, fail 0

       
    • Lee Thomason

      Lee Thomason - 2005-09-28

      ...that is wacky. Can you look at it in a debugger and tell what it child node is?

      lee

       
    • tewis

      tewis - 2005-09-28

      I have reinstalled dev-cpp + tinyxml, created a new workspace with same files (test.xml and test.cpp):

      now i can get my text value!

      i probably had a wrong setup or old tinyxml.dll in same folder....sorry

      thx for your help

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.