An ASP class for XML Data Transfer (VBS class generates XML file), hope

Source: Internet
Author: User
Tags xpath
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>")
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.