code: public void writeExtendedData(XMLStreamWriter xmlOut, ResultSet rs) throws XMLStreamException, SQLException {
          xmlOut.writeStartElement("ExtendedData");
          xmlOut.writeStartElement("SchemaData");
          xmlOut.writeAttribute("schemaUrl", "#" + tableName);
          for (Map.Entry<Integer, String> entry : kmlFields.entrySet()) {
              Integer fieldIndex = entry.getKey();
              String fieldName = entry.getValue();
              writeSimpleData(xmlOut, fieldName, rs.getString(fieldIndex));
          }
          xmlOut.writeEndElement();//Write SchemaData
          xmlOut.writeEndElement();//Write ExtendedData
  
      }
docs: The ExtendedData element offers three techniques for adding custom data
  to a KML Feature (NetworkLink, Placemark, GroundOverlay, PhotoOverlay,
  ScreenOverlay, Document, Folder). These techniques are
  
  Adding untyped data/value pairs using the <Data> element (basic)
  Declaring new typed fields using the <Schema> element and then instancing
  them using the <SchemaData> element (advanced) Referring to XML elements
  defined in other namespaces by referencing the external namespace within
  the KML file (basic)
  
  These techniques can be combined within a single KML file or Feature for
  different pieces of data.
  
  Syntax :
  
  <ExtendedData>
  <Data name="string">
  <displayName>...</displayName> <!-- string -->
  <value>...</value> <!-- string -->
  </Data>
  <SchemaData schemaUrl="anyURI">
  <SimpleData name=""> ... </SimpleData> <!-- string -->
  </SchemaData>
  <namespace_prefix:other>...</namespace_prefix:other>
  </ExtendedData>
  
  @param xmlOut