Altova StyleVision 2023 Enterprise Edition

Declaration: EraseCurrentChild

 

Description

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.

 

Errors


1500

The XMLData object is no longer valid.


1503

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


1900

Document must not be modified

 

Examples

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

// 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))

{

 try

 {

         objEle = objList.GetFirstChild(-1);

         while (objEle != null)

                 objList.EraseCurrentChild();

                 // no need to call GetNextChild

 }

 catch (err)

         // 1503 - we reached end of child list

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

}

© 2017-2023 Altova GmbH