XML Parse format 2

I have a formating issue
My problem is this WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather time-layout/weather-conditions weather-summary[0]")

The above obj Fail with this error msxml3.dll (0x80004005)
Expected token 'eof' found 'NAME'. /dwml/data/parameters/weather -->time-layout<--/weather-conditions weather-summary[0]
/braincell/PFForcaster.asp, line 14

it seems spaces are the issue but I’m not sure

this is what I need <weather-conditions weather-summary="Partly Cloudy" />

This is my XML source: http://www.weather.gov/forecasts/xml/SOAP_server/ndfdSOAPclientByDay.php?lat=47.4828776&lon=-122.2170661&format=24+hourly&startDate=2007-03-26&numDays=3&Submit=Submit/

This is the xml node structure: you can see this in the above link at NOAA
- <weather time-layout="k-p24h-n3-1">
  <name>Weather Type, Coverage, and Intensity</name>
  <weather-conditions weather-summary="Partly Cloudy" />
- <weather-conditions weather-summary="Rain Showers">
  <value coverage="isolated" intensity="none" weather-type="thunderstorms" qualifier="none" />
  <value coverage="isolated" intensity="light" additive="and" weather-type="rain showers" qualifier="none" />
  </weather-conditions>
- <weather-conditions weather-summary="Chance Rain Showers">
  <value coverage="chance" intensity="light" weather-type="rain showers" qualifier="none" />
  </weather-conditions>
  </weather>
derekfurmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Weiping DuSenior Web DeveloperCommented:
should be:  objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions[0]")
Both time-layout and weather-summary are attributes

0
Anthony PerkinsCommented:
>>this is what I need <weather-conditions weather-summary="Partly Cloudy" /><<
Than it looks like you need to allow for more than one node with that attribute. Like now:

<weather time-layout="k-p24h-n3-1">
      <name>Weather Type, Coverage, and Intensity</name>
      <weather-conditions weather-summary="Partly Cloudy" />
      <weather-conditions weather-summary="Partly Cloudy" />
      <weather-conditions weather-summary="Rain Likely">
            <value coverage="likely" intensity="light" weather-type="rain" qualifier="none" />
      </weather-conditions>
</weather>

This XPath will give you all the nodes with that value:
/dwml/data/parameters/weather/weather-conditions[@weather-summary='Partly Cloudy']

0
derekfurmanAuthor Commented:
Please see this link : http://www.weather.gov/forecasts/xml/SOAP_server/ndfdSOAPclientByDay.php?lat=47.4828776&lon=-122.2170661&format=24+hourly&startDate=2007-03-26&numDays=4&Submit=Submit

I tried WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions[0]").text
but return no value with no error other dat is flowing fine just this node returns nuthing

any Ideas
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

derekfurmanAuthor Commented:
I think I’m being confusing here let me try again :

I have this XML : http://www.weather.gov/forecasts/xml/SOAP_server/ndfdSOAPclientByDay.php?lat=47.4828776&lon=-122.2170661&format=24+hourly&startDate=2007-03-26&numDays=4&Submit=Submit

Here is the xml
   <?xml version="1.0" ?>
- <dwml version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">
+ <head>
- <data>
+ <location>
+ <time-layout time-coordinate="local" summarization="24hourly">
+ <time-layout time-coordinate="local" summarization="12hourly">
- <parameters applicable-location="point1">
+ <temperature type="maximum" units="Fahrenheit" time-layout="k-p24h-n4-1">
+ <temperature type="minimum" units="Fahrenheit" time-layout="k-p24h-n4-1">
+ <probability-of-precipitation type="12 hour" units="percent" time-layout="k-p12h-n8-2">
- <weather time-layout="k-p24h-n4-1">
  <name>Weather Type, Coverage, and Intensity</name>
  <weather-conditions weather-summary="Partly Cloudy" />
  <weather-conditions weather-summary="Partly Cloudy" />
- <weather-conditions weather-summary="Rain Likely">
  <value coverage="likely" intensity="light" weather-type="rain" qualifier="none" />
  </weather-conditions>
- <weather-conditions weather-summary="Rain Likely">
  <value coverage="likely" intensity="light" weather-type="rain" qualifier="none" />
  </weather-conditions>
  </weather>
+ <conditions-icon type="forecast-NWS" time-layout="k-p24h-n4-1">
  </parameters>
  </data>
  </dwml>

I need to parse the info in these nodes into my app
<weather-conditions weather-summary="Partly Cloudy" />
<weather-conditions weather-summary="Partly Cloudy" />
<weather-conditions weather-summary="Rain Likely">
<weather-conditions weather-summary="Rain Likely">

Right now this returns nothing with no error what am I doing wrong here
WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions/value[0]")

Below is my ASP page
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Connect XML -->
<%Dim objXML,TempfNodeData0,TempfNodeData1,TempfNodeData2,WeatherCond0,WeatherCond1,WeatherCond2,WeatherPic0,WeatherPic1,WeatherPic2
set objXML = CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
objXML.async = False
objXML.setProperty "ServerHTTPRequest", true
objXML.Load ("http://www.weather.gov/forecasts/xml/SOAP_server/ndfdSOAPclientByDay.php?lat=47.4828776&lon=-122.2170661&format=24+hourly&startDate=2007-03-26&numDays=4&Submit=Submit")
If not objXML.parseError.errorCode <> 0 then
    TempfNodeData0 = objXML.selectsingleNode("/dwml/data/parameters/temperature/value[1]").text
      TempfNodeData1 = objXML.selectsingleNode("/dwml/data/parameters/temperature/value[2]").text
      TempfNodeData2 = objXML.selectsingleNode("/dwml/data/parameters/temperature/value[3]").text
      'WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather time-layout/weather-conditions weather-summary[0]")
      'WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions[1]").text
      'WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions[1]").getattribute("weather-type")
      WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions/value[0]").getattribute("weather-conditions")
      'WeatherCond1 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions/value[8]").getattribute("weather-type")
      'WeatherCond2 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions/value[2]").getattribute("weather-type")
      WeatherPic0 = objXML.selectsingleNode("/dwml/data/parameters/conditions-icon/icon-link[1]").text
      WeatherPic1 = objXML.selectsingleNode("/dwml/data/parameters/conditions-icon/icon-link[2]").text
      WeatherPic2 = objXML.selectsingleNode("/dwml/data/parameters/conditions-icon/icon-link[3]").text
end if
Set objXML = Nothing %>
<!-- XML loaded for parsing End -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
      background-color: #000000;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
.topHeader {
      font-family: Tahoma, Geneva, Arial, Helvetica, Sans-serif;
      font-size: 24px;
      background-image: url(images/pfback.jpg);
      font-weight: bold;
      color: #0000CC;
}
.Bottr {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 24px;
      font-weight: bold;
      color: #FFF300;
      background-image: url(images/pfback2.jpg);
}
.style23 {font-size: 24px; font-family: Tahoma, Geneva, Arial, Helvetica, Sans-serif; font-weight: bold; color: #FFFF00; }
.style24 {
      color: #FFFFFF;
      font-family: Tahoma, Geneva, Arial, Helvetica, Sans-serif;
}
-->
</style>
</head>

<body>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr class="topHeader" background="images/pfback.png">
<td width="78" height="40" align="center">
<%response.write TempfNodeData0 %>&deg;</td>
<td width="78" height="40" align="center">
<%response.write TempfNodeData1 %>&deg;</td>
<td width="78" height="40" align="center">
<%response.write TempfNodeData2 %>&deg;</td>
</tr>
<tr>
<td width="78" align="center" bgcolor="#333333"><img src="<%response.write WeatherPic0 %>" alt="today" width="78" height="66" /></td>
<td width="78" align="center" bgcolor="#333333"><img src="<%response.write WeatherPic1 %>" alt="tomorrow" width="78" height="66" /></td>
<td width="78" align="center" bgcolor="#333333"><img src="<%response.write WeatherPic2 %>" alt="Day after tomorrow" width="78" height="66" /></td>
</tr>
<tr bgcolor="#000099" class="Bottr">
<td width="78" height="40" align="center" class="style23">TUE</td>
<td width="78" height="40" align="center" class="style23">WED</td>
<td width="78" height="40" align="center" class="style23">THUR</td>
</tr>
</table>
<p>&nbsp;</p>
<p><span class="style24">Renton 47.4828776 -122.2170661</span><br />
<span class="style24">
<%response.write WeatherCond0 %>
<br />
<%response.write WeatherCond1 %>
<br />
<%response.write WeatherCond2 %>
<br />
<%response.write WeatherPic0 %>
<br />
<%response.write WeatherPic1 %>
<br />
<%response.write WeatherPic2 %>
</span></p>
<p>&nbsp;</p>
</body>
</html>

0
Weiping DuSenior Web DeveloperCommented:
can you try this:
WeatherCond0 = objXML.selectsingleNode("//dwml/data/parameters/weather/weather-conditions[position()=1]")
0
derekfurmanAuthor Commented:
this is the error I get when i tried that

msxml3.dll (0x80004005)
Unknown method.
//dwml/data/parameters/weather/weather-conditions[-->position()<--=1]
/braincell/PFForcaster.asp, line 17
0
Weiping DuSenior Web DeveloperCommented:
>>I tried WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions[0]").text
>> but return no value with no error other dat is flowing fine just this node returns nuthing

I think that is correct because there is no  text data under weather-conditions[0] in xml file.
You can test it again after you modify your xml to:
<weather-conditions weather-summary="Partly Cloudy"> Whatvere it is here </weather-conditions>
0
derekfurmanAuthor Commented:
its the "partly Cloudy" that I want  <weather-conditions weather-summary="Partly Cloudy" /> i want to draw Partly Cloudy into my app
0
derekfurmanAuthor Commented:
The value of weather-conditions weather-summary=
0
Weiping DuSenior Web DeveloperCommented:
Not sure. I am a Java guy :)   I think it should be one of them:

selectsingleNode("/dwml/data/parameters/weather/weather-conditions[0]").Attributes(0).Text
OR
selectsingleNode("/dwml/data/parameters/weather/weather-conditions[0]").Attributes.item(0).Text
0
Weiping DuSenior Web DeveloperCommented:
Sorry for my jumping in this Q.  I initially thought it only related to XML and XSLT
0
Weiping DuSenior Web DeveloperCommented:
Found a safe way to get it:

objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions[0]").Attributes.getNamedItem("weather-summary").nodeValue
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
derekfurmanAuthor Commented:
Sucess ! your my hero owenli27
Thank you so much
0
Weiping DuSenior Web DeveloperCommented:
Thank you for rewards.  I am just lucky for getting it work.  If it was Java code, I can do it much better.  :)
0
derekfurmanAuthor Commented:
ya know I bet your right.
I will make another question how do I do this with java script
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.