Introduction to the
<%
'----------------------------------------------------------------
' program: Complete the ASP tutorial language to add, delete, modify, view
' entry parameters: No
' export parameters for the specified node text in the XML document: No
'------------------------------------------------ br> ' function name: Connectxml ()
' entry parameter: filename requires connection or Open XML filename
' export parameter: No
' return value: Connectxml=0,xmlmorntekdocument is a success The object that loaded the XML document.
' connectxml<>0, print the error message strerror
'------------------------------------------------
Dim Xmlmorntekdocument
Function connectxml (filename)
Dim strsourcefile
strSourceFile = server.mappath (filename)
Set Xmlmorntek Document = Server.CreateObject ("Microsoft.XMLDOM")
Xmlmorntekdocument.async = False
Xmlmorntekdocument.load ( strSourceFile)
Connectxml=xmlmorntekdocument.parseerror.errorcode
If Xmlmorntekdocument.parseerror.errorcode<>0 then
strerror= " strerror=strerror& xmlmorntekdocument.parseerror.reason& "<br>"
strerror=strerror& xmlmorntekdocument.parseerror.url& "<br>"
Strerror=strerror&xmlmorntekdocument.parseerror.line & "<br>"
strerror=strerror&xmlmorntekdocument.parseerror.filepos& "<br>"
strerror= strerror&xmlmorntekdocument.parseerror.srctext& "<br>"
Response.Write strerror
End If
End function
'------------------------------------------------
' Function name: Closexml ()
' Entry parameters: None
' Exit Parameters: None
'------------------------------------------------
function Closexml (xmlmorntekdocument)
If IsObject (xmlmorntekdocument) Then
Set xmlmorntekdocument=nothing
End If
End Function
'------------------------------------------------
' Function name: Selectxmlnodetext (elementname)
' Entry parameter: The name of the elementname element
' Exit Parameters: None
'------------------------------------------------
function Selectxmlnodetext (elementname)
Elementname= "//" &elementname
Temp=xmlmorntekdocument.selectsinglenode (elementname). Text
selectxmlnodetext= Server.HTMLEncode (temp)
End Function
'------------------------------------------------
' function name: Insertxmlnodetext (Befelementname,elementname, Elementtext)
' entry parameters: ElementName The name of the inserted element
' befelementname insert element
' Elementtext text of inserted element
' export parameter before this element's name: None
'------------------------------------------------
function Insertxmlnodetext (Befelementname,elementname, Elementtext)
Dim befelement,element
Set Befelement=xmlmorntekdocument.selectsinglenode ("//" & Befelementname)
Set element= xmlmorntekdocument.createelement (elementname)
Befelement.insertbefore element, Befelement.firstchild
Element.text=elementtext
End Function
'------------------------------------------------
' Function name: Updatexmlnodetext (Elementname,newelementtext)
' Entry parameter: The name of the elementname element
' New text for newelementtext element
' Exit Parameters: None
'------------------------------------------------
function Updatexmlnodetext (elementname,newelementtext)
Dim element
Set Element=xmlmorntekdocument.selectsinglenode ("//" &elementname)
Element.text=newelementtext
End Function
'------------------------------------------------
' Function name: Deletexmlnodetext (elementname)
' Entry parameter: The name of the elementname element
' Exit Parameters: None
'------------------------------------------------
function Deletexmlnodetext (elementname)
Xmlmorntekdocument.selectsinglenode ("//" &elementname). Text = ""
End Function
%>