The CommandoXML Object

Top  Previous  Next

This object is a very basic class wrapper object for the MSXML DOM (Document Object Model) and provides an easy to use interface to that object to allow rapid development and (if necessary) provide a starting point for developers new to XML programming.  Examples of all of the pertinent XML structures have been included in the API documentation. It is not required that you use the CommandoXML object to create or manipulate XML, we just provide it as a quick and easy interface. 

 

It is not within the scope of this document to teach you what XML is, or how you may best utilize it in your Commando Script projects.

 

System Requirements: The CommandoXML object is MSXML "version independent" in that it will work with either MSXML 2.x OR MSXML 3.x OR MSXML 4.x.  However, the computer must have at least one of these versions of Microsoft XML installed on their computer (not to worry too much though, as they install both with Windows and with MS Internet Explorer).

 

NOTE: CommandoXML objects are not automatically passed into your Commando Script projects (like the oMSG object and the oUTILITIES object).  You have to create them in your code by calling the oUTILITIES.NewCommandoXMLObject() method.

 

 

hmtoggle_arrow1Properties And Methods



XML Property

CountChildNodes()

GetAttributeValue()

GetChildNode()

GetNodeChildren()

GetNodeList()

GetRootChildren()

GetRootElement()

HasChildren()

IsChildNode()

OpenFromString()

OpenFromFile()

RemoveNode()

Save()

SetAttribute()

XMLAddNode()






 

hmtoggle_arrow1Click for 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()