function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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!!!!