Hi guys, ive created an xml file and now need to create an asp which links to the xml file.
i can create xml and asp files seperatly but am strugglin linking them together.
any knowledge wud be great!
what you mean link them?
maybe what you need is xsl:
http://www.w3schools.com/xsl/
Was this answer helpful ?
Yes No
Quote:
| Originally Posted by Shadow Wizard what you mean link them?
maybe what you need is xsl:
http://www.w3schools.com/xsl/ |
i understand xsl. but that will only display data. i think.
i could do with manipulating the data from the xml file via asp.
any ideas?
Was this answer helpful ?
Yes No
here is good article then:
http://www.4guysfromrolla.com/webtech/101200-1.shtml
Was this answer helpful ?
Yes No
here is one i am doing now, it works
you have to alter bits but read it, it is very simple
Code:
<%
Dim xmlDoc, i, prodId, Stock
Dim root
Set xmlDoc = Server.CreateObject("MSXML2.DOMDocument")
xmlDoc.async = False
xmlDoc.setProperty "ServerHTTPRequest", true
xmlDoc.Load ("http://yourdomain.com/xml.xml")
If (xmlDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Response.Write("You have error " & myErr.reason)
Else
Set root = xmlDoc.documentElement
For i = 0 To (root.childNodes.length - 1)
'you will have to alter this for your fields
prodId= cStr(root.childNodes.Item(i).childNodes.Item(0).Te xt)
Stock = cStr(root.childNodes.Item(i).childNodes.Item(1).Te xt)
ToUpdate = HaveGot(prodId)
If ToUpdate <> 0 Then 'update the record
mysql2 = "UPDATE products SET stock="&Stock&" WHERE sku='"&prodId&"'"
call updateDatabase(mysql2,rsTemp2,"updateStock")
call CloseDb()
response.Write "updated record "&prodId&" With Stock Amount:"&Stock& "<BR>"
else
End If
'open database, check for prodid, if have then update quantity with stock
Next
call closeDb()
StrTotal = i
response.Write "there is a total of : " &i& " Records"
End If
Function HaveGot(sku)
mysql = "SELECT sku FROM products WHERE sku='"&sku&"'"
call getFromDatabase(mysql,rstemp3,"checksku")
If not rstemp3.eof Then
HaveGot = -1
Else
HaveGot = 0
End IF
End Function
some of this code was possible because of help i got here, so now i am giving back. i hope it helps
Was this answer helpful ?
Yes No