I have a struts2 application and I am trying to show a KML layer on top of Google Earth using the Google Earth plug-in. I am using: ge.parseKml(kmlString)
If I put the KML string in the script section such as
var kmlString ='<?xml version=\"1.0\" encoding=\"UTF-8\"?> <kml xmlns=\"http://www.opengis.net/kml/2.2\"> <Document> <Camera> <longitude>-122.444633</longitude> <latitude>37.801899</latitude> <altitude>139.629438</altitude> <heading>-70.0</heading> <tilt>75</tilt> </Camera> <Placemark> <name>Placemark from KML string</name> <Point> <coordinates>-122.448425,37.802907,0</coordinates> </Point> </Placemark> </Document> </kml>';
then the marker shows up on the globe. The problem is that this KML string is not fixed, but will be generated after the user selects certain values. So I am getting the KML string from the java bean class property “kmlStr” like this:
var kmlString='<s:property value="kmlStr"/>';
The problem is that the following special characters are replaced '<' becomes '<' and '>' becomes '>'
This breaks the “parseKml” method since the greater than and less then symbols are not interpreted (the marker does not show up).
So the question is how do I can get the string from the java bean property ‘kmlStr’ without
'<' and '>' being replaced to "<" and ">" respectively ?
I think you can use either:
or