+ Start a Discussion

XMLNode GetText() does not WORK!!!!

Why doesn't this code work



 DOM.Document doc = new DOM.Document();
 DOM.XmlNode treeNode =  doc.createRootElement('RootNode', null ,null);
 treeNode.addChildElement('testNode', null, null).addTextNode('hello world');
 System.debug( '===========' + treeNode.getText() );


I would expect it to print out

   <testNode>hello world</testNode>


But Instead I get nothing just a blank string.



Works  But I do NOT want to do this, I want to get the XMLNode text only!!!!