Unable to open my xml file?

danpsy
2011-09-05
2013-05-20
  • danpsy

    danpsy - 2011-09-05

    Here is what I'm currently working with:

    TiXmlDocument doc("test.xml");
    if (doc.LoadFile())
    {
        std::cout << "woo" << std::endl;
        //std::cout << doc.RootElement() -> FirstChildElement() -> Attribute("tag") << std::endl;
    }
    else
    {
        std::cout << "no :(" << std::endl;
    }
    

    test.xml looks like:

    <test>
        <tag>lolol</tag>
    </tes>
    

    Of course I'm also including "tinyxml.h" at the top.

    "no :(" is always returned.  test.xml is in the same directory as my application's binary file.  I'm not sure if anything is directly obvious, but I'm not able to figure out what the issue might be.

    Thanks for any help!

     
  • danpsy

    danpsy - 2011-09-06

    Wow how silly, it seems that my open <test> and close </test> tag didn't match.  (Close tag lacking a "t," only being </tes).

    That's really handy that it won't open the file if there is an issue (like not a matching closing tag), it makes it easier to report parsing errors.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks