An object representing a collection of XML items. This object can be accessed using one of the following methods or properties:
|Count||Returns the number of items in the XML items collection.|
|Item||Returns the item found in the specified position within the XML item collection.|
Returns the number of items in the XML items collection.
The following example uses the Count property to count and display the number of CDATASections in the XML document before and after adding a new CDATASection.
Set doc = XMLUtil.CreateXML() doc.LoadFile "d:\example.xml" Set dataSections = doc.CDataSections() msg = "First I had " & dataSections.Count() & " CDataSections." newSection = "These characters <> are only allowed in CDATASections" doc.AddCDATASection newSection msg = msg + "Now I have " & dataSections.Count() & " CDataSections." msgbox msg
Returns the item found in the specified position within the XML item collection.
The position of the item in the collection. The name (with quotes) or numeric index (with or without quotes) can denote the position. The first item in a collection is numbered 1.
The following example uses the Item property to display the comments in the document one by one.
Set doc = XMLUtil.CreateXML() doc.LoadFile "d:\example.xml" msgbox "The document version of this XML file is " & doc.GetVersion() Set comments = doc.Comments() doc.AddComment "comment1" doc.AddComment "comment2" index = 1 while index <= comments.Count() msgbox "Comment " & index & ": " + comments.Item(index) index = index + 1 wend