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

Example of adding a custom extension?

Expand Messages
  • routeplannerwp
    Hi, While not a total newbie to GPX, I am having trouble understanding custom extensions. I m a mobile software developer and would like to write a GPX file
    Message 1 of 8 , Oct 4, 2012
      Hi,
      While not a total newbie to GPX, I am having trouble understanding custom extensions. I'm a mobile software developer and would like to write a GPX file that contains additional data elements and still be a valid GPX.
      Could someone point me to an example GPX file that has some custom extensions to see how it is implemented?

      Thanks,
      Richard
    • Francois Comparot
      Hi, In this context it would be very helpfull to get the possibility to break the gpx route (like the turtle function hidden does) at one or more points and
      Message 2 of 8 , Oct 8, 2012
        Hi,
        In this context it would be very helpfull to get the possibility to break
        the gpx route (like the turtle function "hidden" does) at one or more
        points and begin again THE SAME course at other points to continue a route
        for example at a different point at the other river of the water etc. in
        case of using gpx files to plan routes where water, aircraft or railway
        transfer etc. have to be used during the performance!
        Regards
        François

        >
        > -------- Original-Nachricht --------
        > Datum: Thu, 04 Oct 2012 18:15:04 -0000
        > Von: "routeplannerwp" <redroosterfarm@...>
        > An: gpsxml@yahoogroups.com
        > Betreff: [gpsxml] Example of adding a custom extension?
        >
        >  
        > Hi,
        > While not a total newbie to GPX, I am having trouble understanding
        > custom extensions. I'm a mobile software developer and would like to
        > write a GPX file that contains additional data elements and still be a
        > valid GPX.
        > Could someone point me to an example GPX file that has some custom
        > extensions to see how it is implemented?
        >
        > Thanks,
        > Richard
        >
        >



        [Non-text portions of this message have been removed]
      • routeplannerwp
        For example, I thought one could add tags like this: this is the extra specific data But this throws
        Message 3 of 8 , Oct 11, 2012
          For example, I thought one could add tags like this:
          <extension>
          <MyTag>
          <mydata>this is the extra specific data</mydata>
          </MyTag>
          </extension>

          But this throws errors in the verification app SaxCount.
          Suggestions?
          Thanks,
          Rick

          --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@...> wrote:
          >
          > Hi,
          > While not a total newbie to GPX, I am having trouble understanding custom extensions. I'm a mobile software developer and would like to write a GPX file that contains additional data elements and still be a valid GPX.
          > Could someone point me to an example GPX file that has some custom extensions to see how it is implemented?
          >
          > Thanks,
          > Richard
          >
        • mel_earp
          I have done this successfully: stuff more stuff
          Message 4 of 8 , Oct 12, 2012
            I have done this successfully:

            <extensions>
            <mynamespace:mytag1>stuff</mynamespace:mytag1>
            <mynamespace:mytag2>more stuff</mynamespace:mytag2>
            </extensions>



            --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@...> wrote:
            >
            > For example, I thought one could add tags like this:
            > <extension>
            > <MyTag>
            > <mydata>this is the extra specific data</mydata>
            > </MyTag>
            > </extension>
            >
            > But this throws errors in the verification app SaxCount.
            > Suggestions?
            > Thanks,
            > Rick
            >
            > --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@> wrote:
            > >
            > > Hi,
            > > While not a total newbie to GPX, I am having trouble understanding custom extensions. I'm a mobile software developer and would like to write a GPX file that contains additional data elements and still be a valid GPX.
            > > Could someone point me to an example GPX file that has some custom extensions to see how it is implemented?
            > >
            > > Thanks,
            > > Richard
            > >
            >
          • Joshua Judson Rosen
            ... If you want your XML to validate, then I think you need to define and use a namespace for the extension elements; there is a half-useful example of this in
            Message 5 of 8 , Oct 12, 2012
              "routeplannerwp" <redroosterfarm@...> writes:
              >
              > For example, I thought one could add tags like this:
              > <extension>
              > <MyTag>
              > <mydata>this is the extra specific data</mydata>
              > </MyTag>
              > </extension>
              >
              > But this throws errors in the verification app SaxCount.
              > Suggestions?

              If you want your XML to validate, then I think you need to define and use
              a namespace for the extension elements; there is a half-useful
              example of this in Wikipedia:

              https://en.wikipedia.org/wiki/GPS_eXchange_Format


              We use Garmin's TrackPointExtension in FoxtrotGPS, with an XML heading
              that looks like this:

              <?xml version="1.0" encoding="UTF-8"?>
              <gpx version="1.1"
              creator="FoxtrotGPS 1.1.1"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v2"
              xmlns="http://www.topografix.com/GPX/1/1"
              xsi:schemaLocation="http://www.topografix.com/GPX/1/1
              http://www.topografix.com/GPX/1/1/gpx.xsd
              http://www.garmin.com/xmlschemas/TrackPointExtension/v2
              http://www8.garmin.com/xmlschemas/TrackPointExtensionv2.xsd">

              ... and then we write the extension elements (inside trkpt elements)
              like this:

              <extensions>
              <gpxtpx:hr>90</gpxtpx:hr>
              </extensions>

              (note that it's "extensions"--plural; not "extension")

              --
              "Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."

              > --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@...> wrote:
              > >
              > > Hi,
              > > While not a total newbie to GPX, I am having trouble understanding custom extensions. I'm a mobile software developer and would like to write a GPX file that contains additional data elements and still be a valid GPX.
              > > Could someone point me to an example GPX file that has some custom extensions to see how it is implemented?
              > >
              > > Thanks,
              > > Richard
            • routeplannerwp
              Thank you for the suggestions. It appears I need to study how to make an .XSD?! I tried simply adding a namespace. Here is the beginning of my test GPX file.
              Message 6 of 8 , Oct 14, 2012
                Thank you for the suggestions. It appears I need to study how to make an .XSD?!

                I tried simply adding a namespace. Here is the beginning of my test GPX file.

                <gpx version="1.0" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0">
                <name><![CDATA[Testing]]></name>
                <desc><![CDATA[]]></desc>
                <time>2012-10-10T01:11:04Z</time>
                <extension>
                <RP8:mytag1>
                <RP8:mydata>this is the extra program specific data</RP8:mydata>
                </RP8:mytag1>
                </extension>
                <wpt lat="43.102326" lon="-84.153889">
                ...

                Running it through SAXcount gives this error:

                Message: no declaration found for element 'extension'
                Fatal Error at file C:\GPXextension/testextension.gpx, line 6, char 15
                Message: prefix 'RP8' can not be resolved to namespace URI
                -------------
                So, I still need an XSD, right? Does version "1.0" or "1.1" matter?
                Is that why there is a problem with element 'extension'?

                Thanks,
                Rick


                --- In gpsxml@yahoogroups.com, "mel_earp" <earpmel@...> wrote:
                >
                > I have done this successfully:
                >
                > <extensions>
                > <mynamespace:mytag1>stuff</mynamespace:mytag1>
                > <mynamespace:mytag2>more stuff</mynamespace:mytag2>
                > </extensions>
                >
                >
                >
                > --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@> wrote:
                > >
                > > For example, I thought one could add tags like this:
                > > <extension>
                > > <MyTag>
                > > <mydata>this is the extra specific data</mydata>
                > > </MyTag>
                > > </extension>
                > >
                > > But this throws errors in the verification app SaxCount.
                > > Suggestions?
                > > Thanks,
                > > Rick
                > >
                > > --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@> wrote:
                > > >
                > > > Hi,
                > > > While not a total newbie to GPX, I am having trouble understanding custom extensions. I'm a mobile software developer and would like to write a GPX file that contains additional data elements and still be a valid GPX.
                > > > Could someone point me to an example GPX file that has some custom extensions to see how it is implemented?
                > > >
                > > > Thanks,
                > > > Richard
                > > >
                > >
                >
              • Lynn W. Deffenbaugh (Mr)
                I m not an expert here, but someone had posted a note to make sure you noticed that it was PLURAL. Lynn (D) - KJ4ERJ
                Message 7 of 8 , Oct 15, 2012
                  I'm not an expert here, but someone had posted a note to make sure you
                  noticed that it was <extensions> PLURAL.

                  Lynn (D) - KJ4ERJ

                  On 10/14/2012 2:59 PM, routeplannerwp wrote:
                  > Thank you for the suggestions. It appears I need to study how to make an .XSD?!
                  >
                  > I tried simply adding a namespace. Here is the beginning of my test GPX file.
                  >
                  > <gpx version="1.0" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0">
                  > <name><![CDATA[Testing]]></name>
                  > <desc><![CDATA[]]></desc>
                  > <time>2012-10-10T01:11:04Z</time>
                  > <extension>
                  > <RP8:mytag1>
                  > <RP8:mydata>this is the extra program specific data</RP8:mydata>
                  > </RP8:mytag1>
                  > </extension>
                  > <wpt lat="43.102326" lon="-84.153889">
                  > ...
                  >
                  > Running it through SAXcount gives this error:
                  >
                  > Message: no declaration found for element 'extension'
                  > Fatal Error at file C:\GPXextension/testextension.gpx, line 6, char 15
                  > Message: prefix 'RP8' can not be resolved to namespace URI
                  > -------------
                  > So, I still need an XSD, right? Does version "1.0" or "1.1" matter?
                  > Is that why there is a problem with element 'extension'?
                  >
                  > Thanks,
                  > Rick
                  >
                  >
                  > --- In gpsxml@yahoogroups.com, "mel_earp" <earpmel@...> wrote:
                  >> I have done this successfully:
                  >>
                  >> <extensions>
                  >> <mynamespace:mytag1>stuff</mynamespace:mytag1>
                  >> <mynamespace:mytag2>more stuff</mynamespace:mytag2>
                  >> </extensions>
                  >>
                  >>
                  >>
                  >> --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@> wrote:
                  >>> For example, I thought one could add tags like this:
                  >>> <extension>
                  >>> <MyTag>
                  >>> <mydata>this is the extra specific data</mydata>
                  >>> </MyTag>
                  >>> </extension>
                  >>>
                  >>> But this throws errors in the verification app SaxCount.
                  >>> Suggestions?
                  >>> Thanks,
                  >>> Rick
                  >>>
                  >>> --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@> wrote:
                  >>>> Hi,
                  >>>> While not a total newbie to GPX, I am having trouble understanding custom extensions. I'm a mobile software developer and would like to write a GPX file that contains additional data elements and still be a valid GPX.
                  >>>> Could someone point me to an example GPX file that has some custom extensions to see how it is implemented?
                  >>>>
                  >>>> Thanks,
                  >>>> Richard
                  >>>>
                  >
                  >
                  >
                  > ------------------------------------
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                • Joshua Judson Rosen
                  ... Well, not necessarily a `.xsd , but you need *some* sort of schema defined for whatever parts of the data you want to be able to validate. By definition,
                  Message 8 of 8 , Oct 16, 2012
                    "routeplannerwp" <redroosterfarm@...> writes:
                    >
                    > Thank you for the suggestions. It appears I need to study how to make an .XSD?!
                    >
                    > I tried simply adding a namespace.

                    Well, not necessarily a `.xsd', but you need *some* sort of schema defined
                    for whatever parts of the data you want to be able to validate.

                    By definition, `validation' requires a schema--otherwise..., well,
                    how would you determine whether your XML was valid? Unless you actually
                    mean that you want to check for *well-formedness* rather than *validity*?

                    Wikipedia's article on XML is a pretty good starting-point--including
                    explanations of what both "validation" and "well-formedness" mean,
                    as well as ways that you can define schemas if you do want XML
                    that uses your elements to be validatable:

                    https://en.wikipedia.org/wiki/XML

                    Also, note that GPX element you want is "extensions" (plural),
                    not "extension"....

                    > Here is the beginning of my test GPX file.
                    >
                    > <gpx version="1.0" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0">
                    > <name><![CDATA[Testing]]></name>
                    > <desc><![CDATA[]]></desc>
                    > <time>2012-10-10T01:11:04Z</time>
                    > <extension>
                    > <RP8:mytag1>
                    > <RP8:mydata>this is the extra program specific data</RP8:mydata>
                    > </RP8:mytag1>
                    > </extension>
                    > <wpt lat="43.102326" lon="-84.153889">
                    > ...
                    >
                    > Running it through SAXcount gives this error:
                    >
                    > Message: no declaration found for element 'extension'
                    > Fatal Error at file C:\GPXextension/testextension.gpx, line 6, char 15
                    > Message: prefix 'RP8' can not be resolved to namespace URI
                    > -------------
                    > So, I still need an XSD, right? Does version "1.0" or "1.1" matter?
                    > Is that why there is a problem with element 'extension'?
                    >
                    > Thanks,
                    > Rick
                    >
                    >
                    > --- In gpsxml@yahoogroups.com, "mel_earp" <earpmel@...> wrote:
                    > >
                    > > I have done this successfully:
                    > >
                    > > <extensions>
                    > > <mynamespace:mytag1>stuff</mynamespace:mytag1>
                    > > <mynamespace:mytag2>more stuff</mynamespace:mytag2>
                    > > </extensions>
                    > >
                    > >
                    > >
                    > > --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@> wrote:
                    > > >
                    > > > For example, I thought one could add tags like this:
                    > > > <extension>
                    > > > <MyTag>
                    > > > <mydata>this is the extra specific data</mydata>
                    > > > </MyTag>
                    > > > </extension>
                    > > >
                    > > > But this throws errors in the verification app SaxCount.
                    > > > Suggestions?
                    > > > Thanks,
                    > > > Rick
                    > > >
                    > > > --- In gpsxml@yahoogroups.com, "routeplannerwp" <redroosterfarm@> wrote:
                    > > > >
                    > > > > Hi,
                    > > > > While not a total newbie to GPX, I am having trouble understanding custom extensions. I'm a mobile software developer and would like to write a GPX file that contains additional data elements and still be a valid GPX.
                    > > > > Could someone point me to an example GPX file that has some custom extensions to see how it is implemented?
                    > > > >
                    > > > > Thanks,
                    > > > > Richard
                    > > > >
                    > > >
                    > >
                    >
                    >
                    >
                    >
                    > ------------------------------------
                    >
                    > Yahoo! Groups Links
                    >
                    >
                    >

                    --
                    "Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."
                  Your message has been successfully submitted and would be delivered to recipients shortly.