hello all,

using version 2.3.0 i created the Java Binding classes for kml version
2.1 (http://code.google.com/apis/kml/schema/kml21.xsd).  parsing a kml
document similar to the following is ok:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1";>
  <Document>
    <name>Document.kml</name>
    <open>1</open>
    <Style id="exampleStyleDocument">
      <LabelStyle>
        <color>ff0000cc</color>
      </LabelStyle>
    </Style>
    <Placemark>
      <name>Document Feature 1</name>
      <styleUrl>#exampleStyleDocument</styleUrl>
      <Point>
        <coordinates>-122.371,37.816,0</coordinates>
      </Point>
    </Placemark>
    <Placemark>
      <name>Document Feature 2</name>
      <styleUrl>#exampleStyleDocument</styleUrl>
      <Point>
        <coordinates>-122.370,37.817,0</coordinates>
      </Point>
    </Placemark>
  </Document>
</kml>

on the other hand, constructing a similar document and saving it
through the generated classes, with an XmlOptions instance set
as follows:

  ...
  setSaveNamespacesFirst();
  setSavePrettyPrint();
  setSavePrettyPrintIndent(2);
  setSaveAggressiveNamespaces();
  final Map<String,String> implicitNamespaces = new HashMap<String,String>();
  implicitNamespaces.put(
      "xsi", "http://www.w3.org/2001/XMLSchema-instance";);
  setSaveImplicitNamespaces(implicitNamespaces);
  setUseDefaultNamespace();
  ...

end up with the following XML:

<kml xmlns="http://earth.google.com/kml/2.1";>
  <Feature xmlns:ns="http://earth.google.com/kml/2.1"; 
xsi:type="ns:DocumentType">
    <name>Document.kml</name>
    <open>true</open>
    <StyleSelector id="exampleStyleDocument" xsi:type="ns:StyleType">
      <LabelStyle>
        <color>FF0000CC</color>
      </LabelStyle>
    </StyleSelector>
    <Feature xsi:type="ns:PlacemarkType">
      <name>Document Feature 1</name>
      <styleUrl>#exampleStyleDocument</styleUrl>
      <Geometry xsi:type="ns:PointType">
        <coordinates>-122.371,37.817</coordinates>
      </Geometry>
    </Feature>
    <Feature xsi:type="ns:PlacemarkType">
      <name>Document Feature 2</name>
      <styleUrl>#exampleStyleDocument</styleUrl>
      <Geometry xsi:type="ns:PointType">
        <coordinates>-122.37,37.817</coordinates>
      </Geometry>
    </Feature>
  </Feature>
</kml>

what i'd like to get when saving the KmlDocument instance is something
close to the first version.

is this possible?  how?


TIA + cheers;
rsn

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to