I could not edit the elements inside the XML object after creating the object, and the Adobe documentation is not clear if this is possible.
To set values dynamically, I created a temporary line and added all my XML nodes and attributes here. Then you can simply create an xml object by specifying your temporary string as a single parameter.
Sort of:
var tempString:String = "<XML_PARENT><SOME_SUB_NODE>";
tempString += "<SOMETHING_ELSE value=\"" + someTextField.text + "\"/>";
tempString += "</SOME_SUB_NODE></XML_PARENT>";
var xmlObj:XML = new XML( tempString );
Now if you trace xmlObj you will get
<XML_PARENT>
<SOME_SUB_NODE>
<SOMETHING_ELSE value=""/>
</SOME_SUB_NODE>
<XML_PARENT>
, , XML . , XML, toString() .
, , XML !