Solved

XML Parse format

Posted on 2007-03-25
2
283 Views
Last Modified: 2013-11-19
XML

I can parse the data from : TempfNodeData0 = objXML.selectsingleNode("/dwml/data/parameters/temperature/value[0]").text

To : <%response.write TempfNodeData0 %>

But I also need:
WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions/value.weather-type[0]").text

To : <%response.write WeatherCond0 %>

The XML looks like this :

- <weather-conditions>
- <value coverage="chance" intensity="light" weather-type="rain showers" qualifier="none">
  <visibility xsi:nil="true" />
  </value>
  </weather-conditions>

I need to parse the data from weather-type="rain showers"
Im sure this is just a lack of understanding the correct format

Example:
<%Dim objXML,TempfNodeData0,WeatherCond0,
set objXML = CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
objXML.async = False
objXML.setProperty "ServerHTTPRequest", true
objXML.Load ("http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLclient.php?lat=48.4212160&lon=-122.3340474&product=glance&begin=2004-01-01t00%3a00%3a00&end=2011-03-25t00%3a00%3a00&maxt=maxt&wx=wx&submit=submit/")
If not objXML.parseError.errorCode <> 0 then
    TempfNodeData0 = objXML.selectsingleNode("/dwml/data/parameters/temperature/value[0]").text
      WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions/value.weather-type[0]").text

end if
Set objXML = Nothing %>


<%response.write TempfNodeData0 %>
<br />
<%response.write WeatherCond0 %>
0
Comment
Question by:derekfurman
2 Comments
 
LVL 14

Accepted Solution

by:
B_Dorsey earned 500 total points
ID: 18789898
try

WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions/value[0]").getattribute("weather-type")
0
 

Author Comment

by:derekfurman
ID: 18794071
Thank you that is the solution!

pleas have a look at my next ?
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now