Altova XMLSpy 2024 Enterprise Edition

Declaration: EraseCurrentChild



EraseCurrentChild deletes the current XMLData child object. Before you call EraseCurrentChild you must initialize an internal iterator with XMLData.GetFirstChild. After deleting the current child, EraseCurrentChild increments the internal iterator of the XMLData element. No error is returned when the last child gets erased and the iterator is moved past the end of the child list. The next call to EraseCurrentChild however, will return error 1503.




The XMLData object is no longer valid.


No iterator is initialized for this XMLData object, or the iterator points past the last child.


Document must not be modified



// ---------------------------------------

// XMLSpy scripting environment - JScript

// erase all children of XMLData

// ---------------------------------------

// let's get an XMLData element, we assume that the

// cursor selects the parent of a list in grid view

var objList = Application.ActiveDocument.GridView.CurrentFocus;


// the following line would be shorter, of course

//        objList.EraseAllChildren ();


// but we want to demonstrate the usage of EraseCurrentChild

if ((objList != null) && (objList.HasChildren))




         objEle = objList.GetFirstChild(-1);

         while (objEle != null)


                 // no need to call GetNextChild


 catch (err)

         // 1503 - we reached end of child list

         { if ((err.number & 0xffff) != 1503) throw (err); }


© 2018-2024 Altova GmbH