NOAA Alerts API Gives GhostXML Illegal Character Error

Posted on
Sat Apr 11, 2020 12:59 pm
Bollar offline
Posts: 526
Joined: Aug 11, 2013

NOAA Alerts API Gives GhostXML Illegal Character Error

I'm trying to replace some creaky code of my own with GhostXML. I'm querying NOAA's API with variations of this string:

https://api.weather.gov/alerts/active/zone/GMZ765 (I selected this zone because it currently has active alerts).

If there are no alerts, the response parses correctly, but if there are alerts, I get this error:

Code: Select all
   GhostXML Error                  General exception: LowLevelBadParameterError -- illegal character in XML tag name or value
Traceback (most recent call last):
  File "plugin.py", line 1151, in refresh_data_for_dev
    dev.stateListOrDisplayStateIdChanged()
StandardError: LowLevelBadParameterError -- illegal character in XML tag name or value


I saw a previous response about reloading the plugin, but that hasn't fixed the error.

It wouldn't surprise me that NOAA is using illegal characters. Is there anything that can be done to filter, or otherwise deal with them?

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Sat Apr 11, 2020 1:09 pm
DaveL17 offline
User avatar
Posts: 5909
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: NOAA Alerts API Gives GhostXML Illegal Character Error

It would be very helpful if you could post (or PM me) the offending XML. If it's like others that I've seen in the past, I should be able to trap the offending character(s) and replace with something that will work. There's no guarantees of course, but we've been able to surmount similar problems in the past.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sat Apr 11, 2020 1:14 pm
Bollar offline
Posts: 526
Joined: Aug 11, 2013

Re: NOAA Alerts API Gives GhostXML Illegal Character Error

Sure. Here’s a sample:

Code: Select all
{
    "@context": [
        "https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld",
        {
            "wx": "https://api.weather.gov/ontology#",
            "@vocab": "https://api.weather.gov/ontology#"
        }
    ],
    "type": "FeatureCollection",
    "features": [
        {
            "id": "https://api.weather.gov/alerts/NWS-IDP-PROD-4149797-3514374",
            "type": "Feature",
            "geometry": null,
            "properties": {
                "@id": "https://api.weather.gov/alerts/NWS-IDP-PROD-4149797-3514374",
                "@type": "wx:Alert",
                "id": "NWS-IDP-PROD-4149797-3514374",
                "areaDesc": "Coastal waters from  Suwannee River to Keaton Beach out 20 NM; Coastal waters from Okaloosa-Walton County Line to Mexico Beach out 20 NM; Waters from Mexico Beach to Apalachicola FL from 20 to 60 NM; Coastal Waters From  Ochlockonee River to Apalachicola FL out to 20 Nm; Waters from Suwannee River to Apalachicola FL from 20 to 60 NM; Apalachee Bay or Coastal Waters From Keaton Beach to Ochlockonee River Fl out to 20 Nm; Coastal Waters from Mexico Beach to Apalachicola out 20 NM; Waters from Okaloosa-Walton County Line to Mexico Beach from 20 to 60 NM",
                "geocode": {
                    "UGC": [
                        "GMZ765",
                        "GMZ750",
                        "GMZ772",
                        "GMZ755",
                        "GMZ775",
                        "GMZ730",
                        "GMZ752",
                        "GMZ770"
                    ],
                    "SAME": [
                        "077765",
                        "077750",
                        "077772",
                        "077755",
                        "077775",
                        "077730",
                        "077752",
                        "077770"
                    ]
                },
                "affectedZones": [
                    "https://api.weather.gov/zones/forecast/GMZ765",
                    "https://api.weather.gov/zones/forecast/GMZ750",
                    "https://api.weather.gov/zones/forecast/GMZ772",
                    "https://api.weather.gov/zones/forecast/GMZ755",
                    "https://api.weather.gov/zones/forecast/GMZ775",
                    "https://api.weather.gov/zones/forecast/GMZ730",
                    "https://api.weather.gov/zones/forecast/GMZ752",
                    "https://api.weather.gov/zones/forecast/GMZ770"
                ],
                "references": [],
                "sent": "2020-04-11T14:28:00-04:00",
                "effective": "2020-04-11T14:28:00-04:00",
                "onset": "2020-04-12T08:00:00-04:00",
                "expires": "2020-04-12T06:00:00-04:00",
                "ends": "2020-04-13T20:00:00-04:00",
                "status": "Actual",
                "messageType": "Alert",
                "category": "Met",
                "severity": "Minor",
                "certainty": "Likely",
                "urgency": "Expected",
                "event": "Small Craft Advisory",
                "sender": "w-nws.webmaster@noaa.gov",
                "senderName": "NWS Tallahassee FL",
                "headline": "Small Craft Advisory issued April 11 at 2:28PM EDT until April 13 at 8:00PM EDT by NWS Tallahassee FL",
                "description": "* WHAT...South winds 15 to 25 kt with gusts up to 30 kt and seas 6\nto 12 feet expected. Seas will be highest west of Mexico Beach.\n\n* WHERE...Gulf waters from the Walton-Okaloosa County line to\nthe Suwannee river out 60 nautical miles.\n\n* WHEN...From 8 AM EDT /7 AM CDT/ Sunday to 8 PM EDT /7 PM CDT/\nMonday.\n\n* IMPACTS...Conditions will be hazardous to small craft.\n\n* ADDITIONAL DETAILS...Brief gale force wind gusts are possible\nSunday afternoon and Sunday night. A line of severe thunderstorms\nis expected to sweep across the waters Sunday Night into Monday\nmorning. Additional brief gale force gusts are possible ahead\nof this line of storms.",
                "instruction": "Inexperienced mariners, especially those operating smaller\nvessels, should avoid navigating in hazardous conditions.",
                "response": "Avoid",
                "parameters": {
                    "NWSheadline": [
                        "SMALL CRAFT ADVISORY IN EFFECT FROM 8 AM EDT /7 AM CDT/ SUNDAY TO 8 PM EDT /7 PM CDT/ MONDAY"
                    ],
                    "VTEC": [
                        "/O.NEW.KTAE.SC.Y.0020.200412T1200Z-200414T0000Z/"
                    ],
                    "PIL": [
                        "TAEMWWTAE"
                    ],
                    "BLOCKCHANNEL": [
                        "CMAS",
                        "EAS",
                        "NWEM"
                    ],
                    "eventEndingTime": [
                        "2020-04-13T20:00:00-04:00"
                    ]
                }
            }
        }
    ],
    "title": "current watches, warnings, and advisories for GMZ765",
    "updated": "2020-04-11T18:28:29+00:00"
}

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Sat Apr 11, 2020 2:32 pm
DaveL17 offline
User avatar
Posts: 5909
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: NOAA Alerts API Gives GhostXML Illegal Character Error

I've isolated the problem character--it's the tags that start with the 'illegal' @ symbol. I've pushed an update to GitHub (as a build, not as a release).

You can download the updated version here. Let me know if you need help installing GitHub builds.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sat Apr 11, 2020 2:33 pm
Bollar offline
Posts: 526
Joined: Aug 11, 2013

Re: NOAA Alerts API Gives GhostXML Illegal Character Error

DaveL17 wrote:
I've isolated the problem character--it's the tags that start with the 'illegal' @ symbol. I've pushed an update to GitHub (as a build, not as a release).

You can download the updated version here. Let me know if you need help installing GitHub builds.

Awesome! I'll give it a shot and report back.

Yep, worked fine and parsed correctly. Thanks!

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Sat Apr 11, 2020 2:41 pm
DaveL17 offline
User avatar
Posts: 5909
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: NOAA Alerts API Gives GhostXML Illegal Character Error

Great -- thanks for letting me know. The change will be a part of the next official release.

Cheers!

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest