Multiple Root Elements in Garmin POIs - is it legal XML?

R

Ramon F Herrera

I extracted the file 'current.gpx' from my Garmin nüvi GPS to take a
look at its contents. See its first lines below.

NetBeans and Eclipse have no problem with it, but when I try to
perform the "View Data Grid" operation in Visual Studio, I get this
message:

"This XML document is not well formed. It contains the following
error: There are multiple root elements".

These are the lines in which it is choking, apparently on
"ele" (elevation)

<wpt lat ="10.036995" lon ="-69.242541">
<ele>423.583374</ele>
<name>A Cabudare Via</name>
<sym>Flag, Blue</sym>
</wpt>

Perhaps the word 'ele' is reserved for element?

-Ramon

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1"
xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3"
creator="nüvi 660" version="1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1
http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3
http://www.garmin.com/xmlschemas/GpxExtensions/v3/GpxExtensionsv3.xsd">

<metadata>
<link href="http://www.garmin.com">
<text>Garmin International</text>
</link>
<time>2007-12-01T22:59:07Z</time>
</metadata>
[...]
 
G

Guest

Visual Studio is correct. A well-formed XML document may not have more
than one root element; if this file does it may be an XML External
Entity (intended to be embedded into another XML document which will
act as a wrapper) but isn't a well-formed XML document by itself.

Not having seen your entire file, and not knowing anything about this
particular product, I can't comment beyond that.
 
G

Guest

Actually, what the other tools may be doing is taking the first root
element and silently ignoring the later one(s). That's legal, by the
XML Recommendation's rules, but I think warning you that you aren't
getting what you intended probably is preferable.
 
R

Ramon F Herrera

Actually, what the other tools may be doing is taking the first root
element and silently ignoring the later one(s). That's legal, by the
XML Recommendation's rules, but I think warning you that you aren't
getting what you intended probably is preferable.

Man, you DO have a blind trust on Microsoft, don't you?

The file has a single root.

Visual Studio displays the file properly and the minus and plus signs
work as expected. I can click on the one and only root, and the whole
tree collapses. It is only when I try to do the conversion to grid
that it fails.

Can a Garmin owner out there verify his/her POIs file, please?

-Ramon
 
R

Ramon F Herrera

I was able to reduce the problem of the rejected XML file to its
minimum expression.

This file: good, proper and valid, is rejected by Visual Studio:

http://patriot.net/~ramon/xml/with-extensions.xml

I get the following error message when I try to convert the file above
using <right-click> "View Data Grid":

http://patriot.net/~ramon/xml/ErrorMess.png

Notice that the error says "Line 37" but the file in question only has
27 lines.

When I remove the "extensions" element, the file is processed and
properly converted.

http://patriot.net/~ramon/xml/no-extensions.xml

If anyone out there has Visual Studio, can you please check both
files?

How do I go about reporting this to Microsoft?

This is my version info:

http://patriot.net/~ramon/xml/VS-version.png

TIA,

-Ramon
 
B

Bruce

I'm not very expert at XML schema but I think the schema is saying that the
extensions element cannot be inside the waypoint element. I don't know how
the extensions is then linked with a waypoint, via the name mabye?

"Line 37" is probably referring to a line in the schema.
 
R

Ramon F Herrera

I'm not very expert at XML schema but I think the schema is saying that the
extensions element cannot be inside the waypoint element. I don't know how
the extensions is then linked with a waypoint, via the name mabye?

There is definitely something wrong with the 'extensions' element. In
my simplified example, all I had to do was to remove the one and only
'extensions' element, and VS processed the XML file properly.

As a further test I took my whole list of waypoints (actually, POIs)
and removed every single 'extensions' element. Again, the file was
processed without any problems.

It remains to be determined whether this problem is a Garmin screwup,
or a Microsoft screwup. Since Sun (via NetBeans' "Check XML" and
"Validate XML") says the file is fine, and IBM (via Eclipse) concurs,
I am inclined to place the blame on Microsoft.

-Ramon
 
B

Bruce

I am inclinded to place the blame on ramon
Ramon F Herrera said:
There is definitely something wrong with the 'extensions' element. In
my simplified example, all I had to do was to remove the one and only
'extensions' element, and VS processed the XML file properly.

As a further test I took my whole list of waypoints (actually, POIs)
and removed every single 'extensions' element. Again, the file was
processed without any problems.

It remains to be determined whether this problem is a Garmin screwup,
or a Microsoft screwup. Since Sun (via NetBeans' "Check XML" and
"Validate XML") says the file is fine, and IBM (via Eclipse) concurs,
I am inclined to place the blame on Microsoft.

-Ramon
 
S

Simon Slavin

<wpt lat =3D"10.036995" lon =3D"-69.242541">

If the '3D's in the lines you quoted are in your text file, then that's
the problem. Can you check ?

Simon.
 
G

Guest

Man, you DO have a blind trust on Microsoft, don't you?

Not sure where that came from. Oh well.
The file has a single root.

Since you didn't show us the full document, but did give us the error
message, I presumed the error message was correct... especially since
it would be a surprising one to get wrong. If you're certain the
message is wrong, take that up with the authors of the failing parser.
 
S

Simon Slavin

This file: good, proper and valid, is rejected by Visual Studio:

http://patriot.net/~ramon/xml/with-extensions.xml

I get the following error message when I try to convert the file above
using <right-click> "View Data Grid":

http://patriot.net/~ramon/xml/ErrorMess.png

Notice that the error says "Line 37" but the file in question only has
27 lines.

When I remove the "extensions" element, the file is processed and
properly converted.

http://patriot.net/~ramon/xml/no-extensions.xml

Here are three possibilities: (A) VS can't handle the 'extensions' part of
the original XML file, (B) it can't access the schema file used to define
the extensions, (C) it can't handle the contents of the schema file.

Here's the schema file:

<http://www.topografix.com/GPX/1/1/gpx.xsd>

I have some experience with this set of extensions and as far as I can see
the syntax in all cases is fine. I have no Windows system to experiment
with.

Simon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top