diff options
-rwxr-xr-x | tinyxml2.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 13b5ce0..20edfae 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1655,8 +1655,18 @@ float XMLElement::FloatAttribute(const char* name, float defaultValue) const const char* XMLElement::GetText() const
{
- if ( FirstChild() && FirstChild()->ToText() ) {
- return FirstChild()->Value();
+ /* skip comment node */
+ const XMLNode* node = FirstChild();
+ while (node) {
+ if (node->ToComment()) {
+ node = node->NextSibling();
+ continue;
+ }
+ break;
+ }
+
+ if ( node && node->ToText() ) {
+ return node->Value();
}
return 0;
}
|