xml spy
Previous  Top  Next
XMLData.EraseCurrentChild


See also

Declaration: EraseCurrentChild

Description

EraseCurrentChild deletes the current XMLData child object. Before you call EraseCurrentChild you must initialize an internal iterator with XMLData.GetFirstChild.

Example

This JavaScript example deletes all elements with the name "EraseMe". The code shows you, that it is possible to call EraseCurrentChild and GetNextChild inside the same loop to continue stepping through the child elements.

   function DeleteXMLElements(objXMLData)
   {
      if
(objXMLData == null)
         return
;
      
      if
(objXMLData.HasChildren)   {   
         var
 objChild;
         objChild = objXMLData.GetFirstChild(-1
);
      
         while
(objChild)   {
            DeleteXMLElements(objChild);
      
            try
   {
               if
(objChild.Name == "EraseMe")
                  objXMLData.EraseCurrentChild();
               
               objChild = objXMLData.GetNextChild();
            }
            catch
(Err)   {
               objChild = null
;
            }
         }
      }
   }



Previous  Top  Next

© 2002 Altova