Menu

NoChildren() oddity and fix.

Adam
2007-05-07
2013-05-20
  • Adam

    Adam - 2007-05-07

    I have great use for NoChildren() though its behavior seems strange to me. I would think it would return false is the FirstChild() is of type TEXT though this is no the case. A simple change would be in order to fix this:
    bool NoChildren() const {
        if (firstChild) {
            if (firstChild->Type() == TiXmlNode::TEXT) { return true; } else { return !firstChild; }
        } else {
            return !firstChild;
        }
    }
    The above change just needs to be made in tinyxml.h around line 700.

     
    • Lee Thomason

      Lee Thomason - 2007-06-02

      TinyXML sees Text nodes as "normal" nodes. It's an artifact of the original design...but changing it changes the whole design of TinyXML. It's one of those "just how it works" things for TinyXML.

      lee

       

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.