XMLData.GetNextChild

www.altova.com このトピックを印刷 前のページ 1つ上のレベル 次のページ

ホーム >  プログラマーのレファレンス > Application API > Interfaces > XMLData >

XMLData.GetNextChild

See also

 

Declaration: GetNextChild as XMLData

 

Return Value

Returns an XML element as XMLData object.

 

Description

GetNextChild steps to the next child of this element. Before you call GetNextChild you must initialize an internal iterator with XMLData.GetFirstChild.

 

Check for the last child of the element as shown in the sample below.

 

Errors


1500

The XMLData object is no longer valid.


1503

No iterator is initialized for this XMLData object.


1510

Invalid address for the return parameter was specified.

 

Examples

' ----------------------------------------------

' VBA code snippet - iterate XMLData children

' ----------------------------------------------

On Error Resume Next

Set objParent = objSpy.ActiveDocument.RootElement

 

'get elements of all kinds

Set objCurrentChild = objParent.GetFirstChild(-1)

 

Do

  'do something useful with the child

 

  'step to next child

  Set objCurrentChild = objParent.GetNextChild

Loop Until (Err.Number - vbObjectError = 1503)

 

 

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

// XMLSpy scripting environment - JScript

// iterate through children of XMLData

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

try

{

 var objXMLData = ... // initialize somehow

 var objChild = objXMLData.GetFirstChild(-1);

 

 while (true)

 {

         // do something usefull with objChild

 

         objChild = objXMLData.GetNextChild();

 }

}

catch (err)

{

 if ((err.number & 0xffff) == 1504)

         ; // element has no children

 else if ((err.number & 0xffff) == 1503)

         ;        // last child reached

 else

         throw (err);

}


(C) 2019 Altova GmbH