0 Replies Latest reply on May 24, 2006 3:30 PM by ntsiii

    e4x: How to update or replace a text node

    ntsiii Level 3
      I can create and append a new text node, but how do I modify the content of a text node? Here is the function I am working on. The first condition works fine, but the second, where there is an existing node is giving me difficulty.

      I looked at replace(), but i cannot figure out how to specify a text node in the first parameter.

      Any suggestions will be appreciated.

      private function onChangeNodeText(oEvent:Object):void
      var nodeTextNode:XML = _xmlNodeCurrent.text()[0]; //get the first(only) text node of current node
      var xmlNew:XML = new XML(oEvent.target.text); //create
      if (nodeTextNode == null) { //if it does not exist
      nodeTextNode = _xmlNodeCurrent.appendChild(xmlNew); //and append it
      else {
      //nodeTextNode = XML(oEvent.target.text); //HOW TO UPDATE?