KML Validator problem

192 views
Skip to first unread message

JohnWoram

unread,
Jul 1, 2010, 12:37:21 PM7/1/10
to KML Developer Support - Getting Started with KML
I just tried the Galdos KML validator on one of my KML files and got
the following bewildering error msg:

cvc-complex-type.2.4.a: Invalid content was found starting with
element 'LookAt'. One of '{"http://www.opengis.net/kml/
2.2":AbstractStyleSelectorGroup,
"http://www.opengis.net/kml/2.2":Region,
"http://www.opengis.net/kml/2.2":PlacemarkObjectExtensionGroup}' is
expected.
(To keep this short, the above shows only 3 of the 9 lines that were
listed.)

FWIW, I already have the "http://www.opengis.net/kml/2.2" in my
header, but I have no clue what needs to be added. So, I went to GE,
created a new placemark and saved it as KML.

Figuring GE would know how to write valid code, I tried Galdos on this
file, and got the same error message, but with a slightly different
list of "is expected" options. So, the big question: Is there a way to
figure out what needs to be added to pass validation? I suppose it
depends on the actual content of the file, but who knows how to
examine the file and then deduce what needs to be edited?

Any suggestions -- or should I just ignore the error message? find
some other validator? or what?

Thanks,
John

Geobrowser

unread,
Jul 1, 2010, 8:03:35 PM7/1/10
to KML Developer Support - Getting Started with KML
John,

Remember that the code produced in GE now contains KML extension
stuff:

e.g. LookAt by default now contains the child
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>

The Galdos validator meanwhile will be working off just the OGC
approved specs, so it won't like the new namespace extension KML. Not
sure if the same is true for other validators out there.

JohnWoram

unread,
Jul 1, 2010, 8:18:14 PM7/1/10
to KML Developer Support - Getting Started with KML
Geobrowser wrote:
> e.g. LookAt by default now contains the child
> <gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>

Hmmm, when I let GE create a new placemark and saved it as KML,
there's no <gx:altitudeMode> tag in the file. In fact, here's the
entire <LookAt> content:

<LookAt>
<longitude>-73.63596</longitude>
<latitude>40.670694</latitude>
<altitude>0</altitude>
<range>4458.027832</range>
<tilt>0</tilt>
<heading>0</heading>
</LookAt>

I'll continue to hunt for some other validator, just to see if I can
make some sense out of this.

shannon9585

unread,
Jul 2, 2010, 9:04:21 AM7/2/10
to KML Developer Support - Getting Started with KML
Do you have a copy of the OGC KML Standards document (http://
www.opengeospatial.org/standards/kml/)? You need to make sure the KML
elements are in the correct order. The error you received ("Invalid
content was found starting with element 'LookAt'....One of...is
expected.") indicates that you may have elements in the wrong order
and that one of the tags that "is expected" should come before
whichever tag is immediately after <LookAt>.

Looking at the code you posted, and comparing it the OGC schema, I can
see your elements are out of order. They should be like this:

<LookAt>
<longitude>-73.63596</longitude>
<latitude>40.670694</latitude>
<altitude>0</altitude>
<heading>0</heading>
<tilt>0</tilt>
<range>4458.027832</range>
</LookAt>

(heading and tilt come before range)

Try moving around those elements and see if it is then valid.

JohnWoram

unread,
Jul 2, 2010, 9:35:10 AM7/2/10
to KML Developer Support - Getting Started with KML
On Jul 2, 9:04 am, shannon9585 wrote:
> Looking at the code you posted, and comparing it the OGC schema, I can
> see your elements are out of order.  They should be like this:
>
> <LookAt>
>    <longitude>-73.63596</longitude>
>    <latitude>40.670694</latitude>
>    <altitude>0</altitude>
>    <heading>0</heading>
>    <tilt>0</tilt>
>    <range>4458.027832</range>
> </LookAt>

That's really odd (to me, that is), because the code I posted was not
mine -- it was generated by GE when I clicked on the "Add Placemark"
button on the Toolbar. Anyway, I re-sequenced the elements as you
showed and that got rid of the "Invalid content" error. But now Galdos
reports the following error:
* Line 6
cvc-complex-type.2.3: Element 'LookAt' cannot have character
[children], because the type's content type is element-only.

I have no idea what "cannot have character..." means though, because
<LookAt> contains (I think) only valid elements. I'll go get the OGC
KML doc and see if I can dope it out.
Thanks for the helpful feedback!

John
Reply all
Reply to author
Forward
0 new messages