Menu

Problem with parsing specific content

Developer
2007-08-14
2013-05-20
  • Jaroslaw Baranowski

    Hi, I have a question whether the following is a bug. I use TiXml 2.5.3.

    --- code: ---
    #include <iostream>
    #include "include/tinyxml.h"

    int main()
    {
        TiXmlDocument TestDocument;
        std::cout << std::boolalpha << "Parsing error: " << TestDocument.Error() << std::endl;
        TestDocument.Parse( "<" );
        std::cout << "Parsing error: " << TestDocument.Error() << std::endl;
        std::cout << "Root element: " << TestDocument.RootElement() << std::endl;
    }

    --- result: ---
    Parsing error: false
    Parsing error: false
    Root element: 0

    What concerns me is the fact that Error() returns false when there is no root element. I suspect that '<' is the suspect here as I have seen some explicit checks for it in TinyXml code. When doing the same test with '>' as only content the strange behavior does not occur.
    I think that this is incorrect behavior. If it is indeed so I will try to make a patch for it.

    Just to mention - compiled on SUSE 10.1 with gcc 4.1.0

    Best Regards,
    Jaroslaw Baranowski

     
    • Lee Thomason

      Lee Thomason - 2007-08-26

      Jaroslaw --

      That's a bug. Please file a bug in the "bugs" section.

      thanks!
      lee

       

Log in to post a comment.