Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the prefix of an XML document which does not have a prefix defined?
    primarykey
    data
    text
    <p><strong>Update</strong> Thanks to florent I now realize I used the wrong term in the question (originally: 'What is the namespace of an XML document which does not have a namespace defined?').<br/> Also, I think now I am asking two questions:<br/> 1. can one assign a prefix to an XML document which does not have a prefix? (probably yes, but how does one do this with classic ASP?)<br/> 2. what is the XPath location path of a node in an XML document which does not have a prefix defined? If this is even possible.</p> <p><br /> 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 prefix defined. I can't change the way the XML document is made.</p> <p>This is how the XML looks:</p> <pre><code>&lt;?xml version="1.0" standalone="yes"?&gt; &lt;SearchResultsResponse xmlns="http://openapi.somesite.com/openapi-3.0.0"&gt; [...] &lt;/SearchResultsResponse&gt; </code></pre> <p><br/> The document is automatically parsed and accessable trough the .responseXML property. But looking up nodes with:</p> <pre><code>Set objData = obj_http.responseXML.selectSingleNode("//someNodeName") Response.Write "Data: " &amp; objData.Text </code></pre> <p>doesn't work. (I get a 'Object Required' error message, meaning no node was found.) And</p> <pre><code>Response.Write obj_http.responseXML.documentElement.prefix </code></pre> <p>gives me an empty string.</p> <p><br/> 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?)</p> <p>I have read that something like: <code>.selectSingleNode("//ns:rootNodeName/ns:childNodeName")</code>, where 'ns' is the prefix defined, should be the way to go, but then what should I use for the prefix if none is defined?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload