w3c / feedvalidator

W3C-customized version of the feedvalidator (forked from https://github.com/rubys/feedvalidator/)
Other
81 stars 37 forks source link

Validation fails without details on feeds with GeoRSS lines or polygons with commas in them #119

Closed Lucidiot closed 1 year ago

Lucidiot commented 1 year ago

Describe the bug

When validating feeds that have items with a georss:line, georss:polygon, or gml:posList element, and where the coordinates are expressed with commas between the latitude and longitude, an error message is shown with no details on the validation errors. A single coordinate pair like in gml:pos, georss:point, gml:lowerCorner and gml:upperCorner does work fine.

To Reproduce

Here is a minimal valid feed that will cause the issue with each of the affected elements:

<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
  <channel>
    <title>Test feed</title>
    <link>https://example.org</link>
    <description>This is a great feed.</description>
    <atom:link rel="self" type="application/rss+xml" href="https://example.org/feed.xml" />

    <item>
      <title>A Post</title>
      <description>Some interesting text</description>
      <guid>https://example.org/post/1/</guid>
      <georss:line>1.2345,1.2345 2.3456,2.3456 3.4567,3.4567</georss:line>
    </item>

    <item>
      <title>A Post, the sequel</title>
      <description>Some interesting text</description>
      <guid>https://example.org/post/2/</guid>
      <georss:polygon>1.2345,1.2345 2.3456,2.3456 3.4567,3.4567 1.2345,1.2345</georss:polygon>
    </item>

    <item>
      <title>A Post, the prequel</title>
      <description>Some interesting text</description>
      <guid>https://example.org/post/3/</guid>
      <georss:where>
        <gml:LineString>
          <gml:posList>1.2345,1.2345 2.3456,2.3456 3.4567,3.4567</gml:posList>
        </gml:LineString>
      </georss:where>
    </item>

    <item>
      <title>A Post, the reboot</title>
      <description>Some interesting text</description>
      <guid>https://example.org/post/4/</guid>
      <georss:where>
        <gml:Polygon>
          <gml:exterior>
            <gml:LinearRing>
              <gml:posList>1.2345,1.2345 2.3456,2.3456 3.4567,3.4567</gml:posList>
            </gml:LinearRing>
          </gml:exterior>
        </gml:Polygon>
      </georss:where>
    </item>
  </channel>
</rss>

When sending this feed, you'll just get "An error occurred while trying to validate this feed.". Replace every comma with a space, and the feed validates.

Expected behavior

The feed should have validated, along with warnings for the commas.

I'm not sure about the gml:posList versions though. The GeoRSS spec says:

Some publishers and users may prefer to separate latitude - longitude coordinate pairs by a comma rather than whitespace. This is permissible in Simple; GeoRSS parsers should just treat commas as whitespace.

It says nothing about GML, and GML defines a posList as <xs:list itemType="xs:double" />, and XSD lists are space-separated only.

Additional context

The original feed that had these issues is here. Removing the items with lines and polygons in them makes the feed validate.

I also found that the CoordComma docs link to georss.org, which has disappeared. Maybe it should point to the OGC GeoRSS spec instead?