NetworkLinkControl does not work in GE 5.0, GE 5.1, but works in GE 4.3 and Google Maps

108 views
Skip to first unread message

GG

unread,
Sep 11, 2009, 12:29:27 PM9/11/09
to KML Developer Support - KML Server Side Scripting
I am developing a server side application used with GE, Google Maps,
Google Maps for mobile to display dynamic data.

It works with GE 4.3, but GE 5.0 (and GE 5.1) raises for each update
the followong error:

Error when parsing file: "http://... at line 2, column 0:
Failed to create object <kml>

How my application works:

1. User loads a small kml file which contains just
<NetworkLink>
<Link>
<href>http://my.domain/kml?cmd=init</href>
</Link>
</NetworkLink>


2. Application receives GET comand, create user's context and reply
with a kml document which contains another <NetworkLink >:
<NetworkLink id="SESSION_001">
<Link>
<href>http://my.domain/kml?SESSION=001</href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>10</refreshInterval>
</Link>
</NetworkLink>

Now, GE shows a small tree:

Link loaded from kml disk file
+- Link received from application


3. On first refresh, application send entire document, which is
displayed properly.
Example:
<Document>
<Placemark id="A011_ID">
<name>Name</name>
<description><Description></description>
</Placemark>
</Document>

Now, I have in GE:
Link loaded from kml disk file
+--- Link received from application
+--- Received document


4. On any subsequent refresh requested by GE, application sends
updates as:
<NetworkLinkControl>
<Update>
<targetHref>http://my.domain/kml?SESSION=001</targetHref>
<Change>
<Placemark targetId="A011_ID">
<description><New description></description>
</Placemark>
</Change>
</Update>
</NetworkLinkControl>

At this point, both GE 5.1 and GE 5.0 show above error message for
each refresh.

Same steps are used with Google Maps without errors.

GB

Roman N

unread,
Sep 18, 2009, 6:27:11 PM9/18/09
to KML Developer Support - KML Server Side Scripting
Hi GB,

Make sure you are including the XML declaration and the root <kml>
element:

<?xml version="1.0"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
...
</kml>

When in doubt, validate your KML with something like http://www.kmlvalidator.org/

Thanks,
Roman

GG

unread,
Sep 21, 2009, 12:35:57 PM9/21/09
to KML Developer Support - KML Server Side Scripting
Hi Roman,

I found the cause! It is not related to network links but to balloons
(WebKit?).

When <NetworkLinkControl> updates <description>, GE raises error when
some special characters are found (percent and degree signs in CDATA
in my case).
No mater if CDATA is used or not, nor if .<description> contains plain
text or HTML.
And only for network updates.

I think GE uses different method to display balloons on <change> than
when loading KML files from disk or network, because my initial
description also contains these special characters and no error is
raised.

Now, what to do? Future GE versions will interpret those characters
properly or user's scripts must replace them with HTML special codes?
I think GE must accept special characters, at least when CDATA is
used.


Thanks a lot,
Gigi Badoi

GG

unread,
Sep 22, 2009, 2:55:16 AM9/22/09
to KML Developer Support - KML Server Side Scripting
Hi, Roman

Special characters errors are not related to balloons only.
For example, updating <name> via <NetworkLinkControl> raises same
error.in GE 5.x if new <name> contains special characters.
The problem resides elsewere.

Gigi

Roman N

unread,
Sep 25, 2009, 7:31:28 PM9/25/09
to KML Developer Support - KML Server Side Scripting
Hi Gigi,

Thanks for filing the bug here:
http://code.google.com/p/kml-samples/issues/detail?id=307

We'll look into this soon. Also, it might speed things up a bit if you
provide complete demo KML files for the bug.

Thanks,
Roman

GG

unread,
Sep 26, 2009, 9:41:17 AM9/26/09
to KML Developer Support - KML Server Side Scripting
I hope this will be useful:

-------------------------------------------------------
Step 1: KML file loaded from local disk:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<NetworkLink>
<name>Name</name>
<description></description>
<Snippet></Snippet>
<visibility>0</visibility>
<Link>
<href>http://192.168.11.7:4007/KML</href>
</Link>
</NetworkLink>
</kml>

-------------------------------------------------------
Step 2: Initial KML document sent by server, after generating unique
session ID for each GE concurrent instances:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<NetworkLink id="N_LNK_4007_1_0">
<name>New link name</name>
<open>1</open>
<Link>
<href>http://192.168.11.7:4007/KML?SESS=0</href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>10</refreshInterval>
</Link>
</NetworkLink>
</kml>

-------------------------------------------------------
Step 3: first KML document send by server on FIRST refresh - this is
working well with special characters:

<?xml version="1.0"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Folder id="A111_FOLDER_4007_1_0">
<name>Folder name</name>
<Snippet></Snippet>
<description></description>
<Placemark id="A111_ICON_4007_1_0">
<name>Name containing % or ° characters</name>
<Snippet></Snippet>
<description><![CDATA[ this is description which may contains % or
° characters ]]></description>
<visibility>1</visibility>
</Placemark>
</Folder>
</Document>
</kml>

-------------------------------------------------------
Step 4: Updates send by server on NEXT refresh - GE raises error here
due presence of % and ° characters

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<NetworkLinkControl>
<Update>
<targetHref>http://192.168.11.7:4007/KML?SESS=0</targetHref>
<Change>
<Placemark targetId="A111_ICON_4007_1_0">
<name>Updated name containing % or ° character</name>
</Placemark>
</Change>
</Update>
</NetworkLinkControl>
</kml>

-------------------------------------------------------
Step 4 alternative 1: Updates send by server on next refresh - this is
working fine, no special characters are used

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<NetworkLinkControl>
<Update>
<targetHref>http://192.168.11.7:4007/KML?SESS=0</targetHref>
<Change>
<Placemark targetId="A111_ICON_4007_1_0">
<name>Updated name without special characters</name>
</Placemark>
</Change>
</Update>
</NetworkLinkControl>
</kml>

-------------------------------------------------------
Step 4 alternative 2: Updates send by server on next refresh - this is
working fine with special characters replaced by HTML code
(I did not tested HTML codes in <name>, just in <description>)

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<NetworkLinkControl>
<Update>
<targetHref>http://192.168.11.7:4007/KML?SESS=0</targetHref>
<Change>
<Placemark targetId="A111_ICON_4007_1_0">
<description><![CDATA[ Updated description with degree sign
&#176; ]]></description>
</Placemark>
</Change>
</Update>
</NetworkLinkControl>
</kml>

carson...@gmail.com

unread,
Oct 1, 2009, 5:34:27 AM10/1/09
to KML Developer Support - KML Server Side Scripting
I'm glad to see someone else with a similar problem:
http://groups.google.com/group/google-earth-browser-plugin/browse_thread/thread/8bfa3e78903e2a4d

The KML I bring in through a networkLink works initially but
eventually fails to reflect any changes that occur in the kml file
(which is rewritten dynamically on another server).
My program has worked for two years and this has crippled it.

I have tried a work around using fetchKml but the same problem occurs.

Reply all
Reply to author
Forward
0 new messages