GetRootElement()

Top  Previous  Next

Method

GetRootElement()

Parameters

None

Returns

Object (DOM Node)

 

 

The GetRootElement() method returns the ROOT node of the XML document

 

Example VBScript Code

 

Private Sub DemoXML()

 

Dim oXML, ndRoot, ndChild

Dim sBuff, i

 

'Create the object

Set oXML = oUTILITIES.NewCommandoXMLObject()

 

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

With oXML

   sBuff = "<ROOT></ROOT>"

   .OpenFromString sBuff

   Set ndRoot = .GetRootElement()

   .SetAttribute ndRoot, "DATE", oUTILITIES.VBFormat(Now, "dd mmm yyyy")

   'Add Some Child Nodes

   sBuff = "<CHILD></CHILD>"

   For i = 1 To 10 

        Set ndChild = .XMLAddNode(ndRoot, sBuff)

        .SetAttribute ndChild, "INDEX", i

   Next   

   'Show the XML

   MsgBox .XML, vbInformation, "The CommandoXML Object"

End With

'Clean up the objects

Set ndRoot = Nothing

Set ndChild = Nothing

Set oXML = Nothing

 

End Sub

 

See Also: oUTILITIES.NewCommandoXMLObject()