XML Help

Associate
Joined
18 Oct 2002
Posts
724
Hiya. I have an XML document that has visits and pageviews data for each country. Im having problems trying to retrieve the visits data when the country is United Kingdom.

The XML is:

Code:
<feed>
 <entry>
    <dxp:dimension name='ga:country' value='United Kingdom'/>
    <dxp:metric confidenceInterval='0.0' name='ga:visits' type='integer' value='7348'/>
    <dxp:metric confidenceInterval='0.0' name='ga:pageviews' type='integer' value='25309'/>
  </entry>
  <entry>
    <dxp:dimension name='ga:country' value='Ireland'/>
    <dxp:metric confidenceInterval='0.0' name='ga:visits' type='integer' value='73/>
    <dxp:metric confidenceInterval='0.0' name='ga:pageviews' type='integer' value='25'/>
  </entry>
</feed>

Heres the code im using (classic asp). The logic im using is finding the dimension with a value of united kingdom, then return to the parent node and get the visits data.

Code:
totalUKVisits = xml.selectSingleNode("//feed/entry/dxp:dimension[@value='United Kingdom']/../dxp:metric[@name='ga:visits']/@value").text

The error im getting:

Code:
msxml3.dll error '80004005'

.. may not appear to the right of / or // or be used with |. //feed/entry/dxp:dimension[@value='United Kingdom']/-->..<--/dxp:metric[@name='ga:visits']/@value

Any help would be greatly appreciated. Thanks
 
Thought you might have. How about trying UK instead.
Just to rule out some problem with a space?

Just throwing things out here...

Of course the other option is to do it in 2 lines instead.
Get the single node and then get the attribute you need.
 
Back
Top Bottom