XML is not well-formed

Discussion of the Meteohub software package

Moderator: Mattk

Post Reply
alexmilowski
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: Wed Sep 21, 2011 5:03 am

XML is not well-formed

Post by alexmilowski »

I've just setup a weather station with Ambient Weather's WeatherHub2 and the XML returned by the device is *NOT* well-formed. I make this request:

http://.../meteolog.cgi?type=xml&mode=data

and I get:


<logger>
<RAIN date=20110921030058 id=rain0 rate=0.0 total=2.1 delta=0.0>
<TH date=20110921030058 id=th0 temp=13.9 hum=88 dew=11.9>
<THB date=20110921030058 id=thb0 temp=25.4 hum=58 dew=16.5 press=996.8 seapress=1012.9 fc=-1>
<WIND date=20110921030058 id=wind0 dir=315 gust=0.0 wind=0.0 chill=13.9>
</logger>

and should be at least:

<logger>
<RAIN date="20110921030058" id="rain0" rate="0.0" total="2.1" delta="0.0">
<TH date="20110921030058" id="th0" temp="13.9" hum="88" dew="11.9">
<THB date="20110921030058" id="thb0" temp="25.4" hum="58" dew="16.5" press="996.8" seapress="1012.9" fc="-1">
<WIND date="20110921030058" id="wind0" dir="315" gust="0.0" wind="0.0" chill="13.9">
</logger>

I do fail to see why the element names 'RAIN', 'TH', etc. are capitalized when every else is not. That doesn't "hurt" my application but the lack of quotes for attribute values means I can never parse the returned data.
rovinj
Junior Boarder
Junior Boarder
Posts: 26
Joined: Mon Feb 16, 2009 9:55 pm

Re: XML is not well-formed

Post by rovinj »

Add quotes=1 at the end, example: http://.../meteolog.cgi?type=xml&mode=data&quotes=1
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7879
Joined: Mon Oct 01, 2007 10:51 pm

Re: XML is not well-formed

Post by admin »

The "old" format is the only one that Weather Display can handle. Therefore, the quotes toggle was introduced.
Post Reply