- We need to update (TITLE) text, where the (ID)=11 to another text
- without knowing in which position the row (MYROW) is.
- Here are the rules for this, i need to use one of these connections listed below, since the Server only support those:
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
Set objXML = Server.CreateObject("MSXML2.DOMDocument")
Set objXML = Server.CreateObject("MSXML2.DOMDocument.3.0")
Set objXML = Server.CreateObject("MSXML2.DOMDocument.6.0")
- Here it's the XML:
<?xml version="1.0" encoding="iso-8859-2" ?>
<xmldata>
<myrow>
<id>10</id>
<title>title1</title>
<msg>Hello world!</msg>
<myrow>
<myrow>
<id>11</id>
<title>title2</title>
<msg>Hello world!</msg>
<myrow>
<myrow>
<id>12</id>
<title>title3</title>
<msg>Hello world!</msg>
<myrow>
</xmldata>
- Here it's the ASP Vb script code that we have at the moment: Note: I already have a code that updates the first row, but is not good when we do not know where the row is.
sub xmlUpdate(xpth)
Set xmlObj = Server.CreateObject("Microsoft.XMLDOM")
xmlObj.async = False
xmlObj.setProperty "ServerHTTPRequest", True
xmlObj.Load(xpth)
If xmlObj.parseError.errorCode <> 0 Then
Response.Write "Error Reading File - " & xmlObj.parseError.reason & "<p>"
End If
'---we need the rest of the code bellow-------------------------
'---------------------------------------------------------------
xmlObj.save(xpth)
end sub
No comments:
Post a Comment