this is my first foray into xml and I am struggling to find anything on the web relating to what I want to do.
I have an xml file of a format
<products>
<product>
<name>product1</name>
<desc>this is product 1 description</desc>
<price>this is product 1 price</price>
<image>this is an image of product 1</image>
</product>
</products>
I need to search the 'name' node and output a list of results that contains the name, price and image.
I have found many articles that output the entire xml or search on name and only output name, but I need to output other fields too.
Here is what I have so far
This will open my xml and search the name column for the search term the user entered but only output the name field, how do I output other fields such as price and image also?
Thanks
I have an xml file of a format
<products>
<product>
<name>product1</name>
<desc>this is product 1 description</desc>
<price>this is product 1 price</price>
<image>this is an image of product 1</image>
</product>
</products>
I need to search the 'name' node and output a list of results that contains the name, price and image.
I have found many articles that output the entire xml or search on name and only output name, but I need to output other fields too.
Here is what I have so far
Code:
Dim name
Dim xmlDoc
Dim rootNode
strSearch= lcase(request.form("strKeywords"))
response.write strSearch
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM") xmlDoc.async="false"
xmlDoc.load(Server.MapPath("file.xml"))
Set rootNode = xmlDoc.documentElement
If rootNode.hasChildNodes() Then
For Each pageNode in rootNode.childNodes
For Each propertyNode in pageNode.childNodes
If propertyNode.nodeName = "name" Then
If InStr(lcase(propertyNode.Text), strSearch) Then
Response.write "" & propertyNode.Text & ""
End If
End If
Next
Next
End If
This will open my xml and search the name column for the search term the user entered but only output the name field, how do I output other fields such as price and image also?
Thanks