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
dke01dke01 

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

<RootNode>
   <testNode>hello world</testNode>
</RootNode>

 

But Instead I get nothing just a blank string.

 

Calling 

 System.debug('==============='+doc.toXmlString());
Works  But I do NOT want to do this, I want to get the XMLNode text only!!!!