Recommended: ASP adds, deletes, modifys, and views text in XML documents % '---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The main methods and implementation of ASP to operate XML files on the server side through XMLDom
For small data volumes, xml files have many advantages in retrieval and updates on ACCESS.
I once tested that the website member information, product data information, transaction information, and website custom information were stored in three xml files without using a database. The operation result was very normal, and it felt much faster than the database, but it was not tested and could not be confirmed.
Let’s talk about the main methods of creating, querying, modifying, etc.
'Create a DOM object
set objDom=server.CreateObject("MicroSoft.XMLDom")
'Get 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("
'Create a node object
Set Newnode=objDom.CreateElement("people")
'Give this node value
Newnode.Text="People"
' Add attributes to this node
Set NewAttribute=objDom.CreateNode("attribute","name","")
NewAttribute.Text= "Zhang San"
Newnode.SetAttributeNode NewAttribute
'Add child nodes to this node
Set NewnodeChild=objDom.CreateElement("address")
Newnode.appendChild NewnodeChild
'Save this node object
objDom.appendChild Newnode
objDom.save("c:/test.xml")
'Find a node object
set objtofind=objdom.documentElement.SelectSingleNode("//people/man")
'Fetch out the node name, node value, a certain attribute value, and all xml of this node object
nodename=objtofind.nodename
nodevalue=objtofind.text
objtofind.GetAttributeNode("name").Nodevalue 'Attribute value whose attribute is named name
'Take out an attribute node object
set objattrtofind=objdom.documentElement.SelectSingleNode("//people/man"). GetAttributeNode("name")
'Take out the attribute name of this node and the attribute value
nodeattrname=objattrtofind.nodename
nodeattrvalue=objattrtofind.nodevalue
Share: asp+sql2000 stored procedure pagination example 1. Return the stored procedure of the total number of records sets: CREATE procedure dbo.recordCount ( @TableName nvarchar(100), --Database table name @strWhere nvarchar(500), --Query condition @count int output---Output value, total number of records sets) as declare @sqlStr nvarchar(1000) if @strWhere != '' set @sqlSt
2 pages in total Previous page 12 Next page