code: private void writeSchema(XMLStreamWriter xmlOut, ResultSetMetaData metaData) throws XMLStreamException, SQLException {
          columnCount = metaData.getColumnCount();
          //The schema is writing only if there is more than one column
          if (columnCount > 1) {
              xmlOut.writeStartElement("Schema");
              xmlOut.writeAttribute("name", tableName);
              xmlOut.writeAttribute("id", tableName);
              //Write column metadata
              kmlFields = new HashMap<Integer, String>();
              for (int fieldId = 1; fieldId <= metaData.getColumnCount(); fieldId++) {
                  final String fieldTypeName = metaData.getColumnTypeName(fieldId);
                  if (!fieldTypeName.equalsIgnoreCase("geometry")) {
                      String fieldName = metaData.getColumnName(fieldId);
                      writeSimpleField(xmlOut, fieldName, getKMLType(metaData.getColumnType(fieldId), fieldTypeName));
                      kmlFields.put(fieldId, fieldName);
  
                  }
              }
              xmlOut.writeEndElement();//Write schema
          }
      }
docs: Specifies a custom KML schema that is used to add custom data to KML
  Features. The "id" attribute is required and must be unique within the
  KML file.
  <Schema> is always a child of <Document>.
  
  Syntax :
  
  <Schema name="string" id="ID">
  <SimpleField type="string" name="string">
  <displayName>...</displayName> <!-- string -->
  </SimpleField>
  </Schema>
  
  @param xmlOut
  @param tableName