(All Dom methods and attributes can be viewed in vs's Object Browser)
'Create a DOM object
Set objdom = server. Createobject ("Microsoft. xmldom ")
'Retrieve XML data
'Method 1: Get the XML data of the XML file
Objdom. Load ("C: \ test. xml ")
'Method 2: Get the data of the XML data string
Objdom. loadxml ("<people> <man name =" SD "> </People> ")
'Create a Node object
Set newnode = objdom. createelement ("people ")
'Return value to this node
Newnode. Text = "person"
'Add attributes to this node
Set newattride = objdom. createnode ("attribute", "name ","")
Newattri. Text = "James"
Newnode. setattributenode newattribute
'Add a subnode to this node
Set newnodechild = objdom. createelement ("Address ")
Newnode. appendchild newnodechild
'Save this Node object
Objdom. appendchild newnode
Objdom. Save ("C: \ test. xml ")
'Look up a Node object
Set objtofind=objdom.doc umentelement. selectsinglenode ("// people/Man ")
'Get the node name, node value, attribute value, and all XML of the Node object.
Nodename = objtofind. nodename
Nodevalue = objtofind. Text
Objtofind. getattributenode ("name"). nodevalue
'Retrieve an attribute Node object
Set objattrtofind=objdom.doc umentelement. selectsinglenode ("// people/Man"). getattributenode ("name ")
'Retrieve the attribute name and attribute value of this node.
Nodeattrname = objattrtofind. nodename
Nodeattrvalue = objattrtofind. nodevalue
'Delete a Node object
Set objnode1_objdom.doc umentelement. selectsinglenode ("// people/Man") 'node to be deleted
Set objparentnode1_objdom.doc umentelement. selectsinglenode ("// people") 'parent node of the node to be deleted
Objparentnode. removechild objnode
'Retrieve the byte point set of a node
Set objnodesnodes objdom.doc umentelement. selectsinglenode ("// people/Man"). childnodes
Traverse this set
Method 1
For each element in objnodes
Response. Write element. nodename byte name
Response. Write element. Text byte point value
Next
Method 2
Domlength = objnodes. Length
For I = 0 to domlength-1
Response. Write objnodes. childnodes (I). nodename byte name
Response. Write objnodes. childnodes (I). Text byte point value
Next
'Retrieve the attribute set of a node
Set objnodesincluobjdom.doc umentelement. selectsinglenode ("// people/Man"). getattributenode ("name"). Attributes
Traverse this set
For each element in objnodes
Response. Write element. nodename attribute name
Response. Write element. nodevalue Attribute Value
Next