Menu

Somting wrong with GetText()

xucm02
2006-04-12
2013-05-20
  • xucm02

    xucm02 - 2006-04-12

    If there is a Element as bellow:
    <element name="style"></element>
    what will happen when I call the method Element.GetText()?

     
    • Lee Thomason

      Lee Thomason - 2006-04-18

      It should return null, because the element does not have a child text node.

      lee

       
    • Koen Tanghe

      Koen Tanghe - 2006-05-12

      Strange. I would have thought that there was a text element, having an emty string value.
      Also, the strange thing is that you usually did use a "theElement->LinkEndChild(new TiXmlText(someString))" to generate the XML, so one would expect a text element back when reading back the file, no? Are there specific reasons why this is not so?

       
    • Lee Thomason

      Lee Thomason - 2006-05-21

      Koen --

      This XML:

      <element name="style"></element>

      has no child Text node. Assuming GetText is called on the element above, there is simply nothing to return.

      lee

       
    • JohnnyWonder

      JohnnyWonder - 2006-12-01

      just curious, how would this line be effected with that:

      <Property Name="seconds" secs="02"/>

      would it return ' 02 '

       
    • Lee Thomason

      Lee Thomason - 2006-12-03

      ...it still has no text element. :)

      It does have the attribute "secs" with the value "02".

      lee

       

Log in to post a comment.