Altova Authentic 2024 Browser Edition

XMLData.EraseCurrentChild

Accueil Préc Haut Suivant

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;

                         }

                 }

         }

 }

 

© 2017-2023 Altova GmbH