I have classic ASP code which retrieves an XML document using the MSXML2.ServerXMLHTTP.6.0 object, but the XML document does not have a namespace defined. I can't change the way the XML document is made.This is how the XML looks:\[code\]<?xml version="1.0" standalone="yes"?><SearchResultsResponse xmlns="http://openapi.somesite.com/openapi-3.0.0">[...]</SearchResultsResponse> \[/code\]
The document is automatically parsed and accessable trough the .responseXML property. But looking up nodes with:\[code\]Set objData = http://stackoverflow.com/questions/13826295/obj_http.responseXML.selectSingleNode("//someNodeName")Response.Write "Data: " & objData.Text\[/code\]doesn't work. (I get a 'Object Required' error message, meaning no node was found.) And\[code\]Response.Write obj_http.responseXML.documentElement.prefix \[/code\]gives me an empty string.
One way to make this work is to use \[code\].selectSingleNode("//*[local-name() = 'someNodeName']")\[/code\], but I guess this is not very efficient in larger XML documents. (Or am I wrong there?)I have read that something like: \[code\].selectSingleNode("//ns:rootNodeName/ns:childNodeName")\[/code\], where 'ns' is the namespace defined, should be the way to go, but then what should I use for the namespace if none is defined?
The document is automatically parsed and accessable trough the .responseXML property. But looking up nodes with:\[code\]Set objData = http://stackoverflow.com/questions/13826295/obj_http.responseXML.selectSingleNode("//someNodeName")Response.Write "Data: " & objData.Text\[/code\]doesn't work. (I get a 'Object Required' error message, meaning no node was found.) And\[code\]Response.Write obj_http.responseXML.documentElement.prefix \[/code\]gives me an empty string.
One way to make this work is to use \[code\].selectSingleNode("//*[local-name() = 'someNodeName']")\[/code\], but I guess this is not very efficient in larger XML documents. (Or am I wrong there?)I have read that something like: \[code\].selectSingleNode("//ns:rootNodeName/ns:childNodeName")\[/code\], where 'ns' is the namespace defined, should be the way to go, but then what should I use for the namespace if none is defined?