Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 8:28 on August 25, 2006

[XML&ASP] How to amend ASP XML element values?

To handle XML documents :
[code]
"?xml Version=" 1.0 "encoding=" utf-8 "Background
"Basic>
"Name>abcdefg</name>
"/basic>
[/code]
First reading the XML document node to a value such as : Form
[code]
<%
Set objXML = Server.CreateObject ( "Microsoft.XMLDOM")
ObjXML.Load (Server.MapPath ( "b.xml"))
StrName = objXML.documentElement.firstChild.text
Set objXML = Nothing
%>
"Form action=" test.asp "method=" post ""
"Input type=" text "size =" 40 "name="_ftn1"" host "value=" "%=strName%>" "
"Input type=" submit "value=" -- set -- ""
"/form>
[/code]

Question :
1, as amended after submission form corresponding to the elements in XML documents
2, when using this phrase duty time element there (wrong number of parameters or invalid parameter attribute values) in the wrong, how
StrName = objXML.getElementsByTagName ( "name")

UPPPPPPPPPPPP

Nongliaoge stupid, the first XML delete and add a new element, and that is very troublesome, there is no direct changes to the designated elements of the solution?
[code]
<%
Set objXML = Server.CreateObject ( "Microsoft.XMLDOM")
ObjXML.async = False
ObjXML.Load (Server.MapPath ( "basicinfo.xml"))
Set objHost = objXML.documentElement.SelectSingleNode ( "basic_host")
StrHost = objHost.text

Str = Request ( "host")
Set objXD = objXML.documentElement.SelectSingleNode ( "basic_host")
ObjXML.documentElement.RemoveChild (objXD)

Set objXA = objXML.documentElement.AppendChild (objXML.createElement ( "basic_host"))
ObjXA.text = str

ObjXML.Save Server.MapPath ( "basicinfo.xml")
Set objXML = Nothing
%>
"Form action=" test.asp "method=" post ""
BLOG address : "input type=" text "size =" 40 "name="_ftn1"" host "value=" "%=strHost%>" "
"Input type=" submit "value=" -- set -- ""
"/form>
[/code]

UPPPPPPPPPPPP

You are not accustomed to the changes that node to the location?
If this is possible, given the new values directly on the list.

[code]
<%
Set objXML = Server.CreateObject ( "Microsoft.XMLDOM")
ObjXML.async = False
ObjXML.Load (Server.MapPath ( "basicinfo.xml"))
Set objHost = objXML.documentElement.SelectSingleNode ( "basic_host")
StrHost = objHost.text

Str = Request ( "host")
Set objXD = objXML.documentElement.SelectSingleNode ( "basic_host")

'This CELLPADDING
ObjXD.text = "xxxxx"

ObjXML.Save Server.MapPath ( "basicinfo.xml")
Set objXML = Nothing
%>
"Form action=" test.asp "method=" post ""
BLOG address : "input type=" text "size =" 40 "name="_ftn1"" host "value=" "%=strHost%>" "
"Input type=" submit "value=" -- set -- ""
"/form>
[/code]

This is ah, thank Haigeleier, yesterday did not make out of a pain that no stupid way, 3
Or they learn better study XMLDOM
Http://www.china-pub.com/computers/common/info.asp?id=14777
This book stresses the DOM, it was seen how?




 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com