Loading ...
Sorry, an error occurred while loading the content.

Error in GPX 1.0 schema definition of emailType

Expand Messages
  • Dan Foster
    Hello gpsxml, I just noticed that GPX 1.0 files fail to validate if the email address contains a number. cat@dog.com validates.
    Message 1 of 2 , May 7, 2007
    View Source
    • 0 Attachment
      Hello gpsxml,

      I just noticed that GPX 1.0 files fail to validate if the email
      address contains a number.

      <email>cat@...</email> validates.
      <email>cat@...</email> does not validate.


      Here's the offending regular expression for emailType:

      <xsd:simpleType name="emailType">
      <xsd:restriction base="xsd:string">
      <xsd:pattern value="[\p{L}_]+(\.[\p{L}_]+)*@[\p{L}_]+(\.[\p{L}_]+)+" />
      </xsd:restriction>
      </xsd:simpleType>


      Anyone care to offer a corrected pattern? Should we just change this
      back to an xsd:string? (The pattern was suggested as a way to
      ensure that the email address was valid)

      A quick google search suggests to me that we punt on this and change
      it back to xsd:string. I believe this DOES need to get retroactively
      fixed in the GPX 1.0 schema.


      Note that this is not an issue in GPX 1.1 because we broke emailType
      into two parts to thwart email harvesting from GPX files:
      <xsd:complexType name="emailType">
      - <xsd:annotation>
      <xsd:documentation>An email address. Broken into two parts (id and domain) to help prevent email harvesting.</xsd:documentation>
      </xsd:annotation>
      - <xsd:attribute name="id" type="xsd:string" use="required">
      - <xsd:annotation>
      <xsd:documentation>id half of email address (billgates2004)</xsd:documentation>
      </xsd:annotation>
      </xsd:attribute>
      - <xsd:attribute name="domain" type="xsd:string" use="required">
      - <xsd:annotation>
      <xsd:documentation>domain half of email address (hotmail.com)</xsd:documentation>
      </xsd:annotation>
      </xsd:attribute>
      </xsd:complexType>

      --
      Dan Foster
    • Dave Patton
      ... In Appendix B of the first edition of Jeffrey Friedl s book Mastering Regular Expressions he lists an optimized version of a regex for validating email
      Message 2 of 2 , May 7, 2007
      View Source
      • 0 Attachment
        Dan Foster wrote:
        > Hello gpsxml,
        >
        > I just noticed that GPX 1.0 files fail to validate if the email
        > address contains a number.
        >
        > <email>cat@...</email> validates.
        > <email>cat@...</email> does not validate.
        >
        >
        > Here's the offending regular expression for emailType:
        >
        > <xsd:simpleType name="emailType">
        > <xsd:restriction base="xsd:string">
        > <xsd:pattern value="[\p{L}_]+(\.[\p{L}_]+)*@[\p{L}_]+(\.[\p{L}_]+)+" />
        > </xsd:restriction>
        > </xsd:simpleType>
        >
        >
        > Anyone care to offer a corrected pattern? Should we just change this
        > back to an xsd:string? (The pattern was suggested as a way to
        > ensure that the email address was valid)
        >
        > A quick google search suggests to me that we punt on this and change
        > it back to xsd:string.

        In Appendix B of the first edition of Jeffrey Friedl's
        book Mastering Regular Expressions he lists an "optimized
        version" of a regex for validating email addresses. It
        is 6,598 bytes long, but is faster than the 4,724-byte
        regex developed earlier in the book. The bottom line is
        that, at the time the first edition of his book was written,
        it wasn't possible to use a regex to validate an email
        address, because the spec (RFC 822) allows address
        comments to be nested. His example compromises and will
        work if only one level of nested comments is allowed.
        Maybe now some of the regex engines can handle the task,
        but it would certainly be easier to drop the regex
        for emailType.

        --
        Dave Patton

        Canadian Coordinator, Degree Confluence Project
        http://www.confluence.org/

        Personal website - Maps, GPS, etc.
        http://members.shaw.ca/davepatton/
      Your message has been successfully submitted and would be delivered to recipients shortly.