There are two files:
Objxml.asp: Test File
ClsXML.asp:vbs class file
Code:
Objxml.asp
<%@ Language=vbscript%>
<% Option Explicit%>
<!--#INCLUDE file= "clsxml.asp"-->
<%
Dim objxml, strpath, str
Set objxml = New clsxml
strpath = Server.MapPath (".") & "New.xml"
Objxml.createfile strpath, "Root"
' Or If using an existing XML file:
' Objxml.file = ' c:file.xml '
Objxml.createrootchild "Images"
' Here's only one of the added to the Images/image Node
Objxml.createchildnodewattr "Images", "Image", "id", "1"
Objxml.updatefield "images//image[@id =1]", "Super.gif"
Objxml.createrootnodewattr "Jobs", Array ("Size", "Length", "Width"), _
Array (24, 31, 30)
Objxml.createrootnodewattr "Jobs", Array ("Size", "Length", "Width"), _
Array (24, 30, 29)
Objxml.createrootnodewattr "Jobs", Array ("Size", "Length", "Width"), _
Array (24, 31, 85)
' Notice ' All three job nodes have size, all of those
' Nodes'll be updated
Objxml.updatefield "jobs[@Size =24]", "s"
' Notice that two nodes have the specified XPath, hence
' Only two the new child nodes'll be added
Objxml.createchildnodewattr "jobs[@Size =24 and @Length =31]", "Specs", _
Array ("Wood", "Metal", "Color"), _
Array ("Cedar", "aluminum", "Green")
' It is always important to iterate through all of the nodes
' returned by this XPath query.
For each str in Objxml.getfield ("jobs[@Size = 24]")
Response.Write (str & "<br>")
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.