Logo Search packages:      
Sourcecode: rarian version File versions

void TiXmlElement::SetAttribute ( const char *  name,
const char *  _value 
)

Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does.

Definition at line 763 of file tinyxml.cpp.

References TiXmlNode::GetDocument(), TiXmlDocument::SetError(), and TiXmlAttribute::SetValue().

Referenced by SetAttribute(), and SetDoubleAttribute().

{
      TIXML_STRING _name( cname );
      TIXML_STRING _value( cvalue );

      TiXmlAttribute* node = attributeSet.Find( _name );
      if ( node )
      {
            node->SetValue( cvalue );
            return;
      }

      TiXmlAttribute* attrib = new TiXmlAttribute( cname, cvalue );
      if ( attrib )
      {
            attributeSet.Add( attrib );
      }
      else
      {
            TiXmlDocument* document = GetDocument();
            if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
      }
}


Generated by  Doxygen 1.6.0   Back to index