HasChildren()

Top  Previous  Next

Method

HasChildren(oNode)

Parameters

oNode (object, MSXML DOM Node)

Returns

Boolean

Example

See Below.  The HasChildren() method returns True if oNode has ChildNodes

 

 

Example VBScript Code

 

Private Sub DemoXML()

 

Dim oXML, ndRoot, ndList

Dim sBuff, i

 

'Create the object

Set oXML = oUTILITIES.NewCommandoXMLObject()

 

'Using the With / End With statements make for easy shortcuts

With oXML

   'Open an XML File

   If Not .OpenFromFile(oUTILITIES.ApplicationPath & "MyFileName.XML") Then

     SMEvent.Raise "ERROR", "XML File Open Failed"

   End If

    Set ndRoot = .GetRootElement()   

   If .HasChildren(ndRoot) Then 

     Set ndList = .GetRootChildren()

     'NOTE: ndRoot is just an MS XML Dom Node so this would also work:

     'Set ndList = ndRoot.ChildNodes

     MsgBox "The root element has " & ndList.Length & " Child Nodes"

   End If    

   'Show the XML

   MsgBox .XML, vbInformation, "The CommandoXML Object"

End With

'Clean up the objects

Set ndRoot = Nothing

Set ndList = Nothing

Set oXML = Nothing

 

End Sub

 

See Also: oUTILITIES.NewCommandoXMLObject()