Add SetText() as analog to GetText().

This commit is contained in:
Uli Kusterer 2014-01-21 01:12:47 +01:00
parent 44ce7930b7
commit 8fe342a872
2 changed files with 15 additions and 3 deletions

View File

@ -1260,6 +1260,16 @@ const char* XMLElement::GetText() const
} }
void XMLElement::SetText( const char* inText )
{
if ( FirstChild() )
FirstChild()->SetValue( inText );
else {
XMLText* theText = GetDocument()->NewText( inText );
InsertFirstChild( theText );
}
}
XMLError XMLElement::QueryIntText( int* ival ) const XMLError XMLElement::QueryIntText( int* ival ) const
{ {
if ( FirstChild() && FirstChild()->ToText() ) { if ( FirstChild() && FirstChild()->ToText() ) {

View File

@ -1369,6 +1369,8 @@ public:
*/ */
const char* GetText() const; const char* GetText() const;
void SetText( const char* inText );
/** /**
Convenience method to query the value of a child text node. This is probably best Convenience method to query the value of a child text node. This is probably best
shown by example. Given you have a document is this form: shown by example. Given you have a document is this form: