public class KMLUtils extends Object
| Constructor and Description |
|---|
KMLUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Set<String> |
findElementIdentifiers(Source kmlSource,
String xpath)
Finds KML elements selected by the given XPath expression and returns
their identifiers.
|
static AltitudeMode |
getAltitudeMode(Element element)
Gets the altitude mode for the given KML element.
|
static Map<String,net.sf.saxon.s9api.ItemType> |
getDeclaredFields(net.sf.saxon.s9api.XdmNode schema)
Gets information about the fields declared in a custom schema.
|
static Document |
parseKMLDocument(File file)
Parses the content of the given file as a KML resource and returns the
resulting DOM document node.
|
static Document |
parseKMLDocumentInArchive(File file)
Reads the given KMZ archive file and parses the first root-level KML
document found within it.
|
public static Document parseKMLDocument(File file) throws IOException, SAXException
file - A file containing a KML resource (KML or KMZ).IOException - If the file cannot be read for some reason (e.g. it doesn't
exist).SAXException - If the file does not contain well-formed XML.public static Document parseKMLDocumentInArchive(File file) throws IOException, SAXException
.kml extension is
expected, however.file - A File object that presumably represents a KMZ file (ZIP
archive).null if a root-level KML file could
not be found in the archive.IOException - The file is not a valid ZIP archive or some other I/O error
occurred.SAXException - If a KML document was found but it is not well-formed.public static Set<String> findElementIdentifiers(Source kmlSource, String xpath)
A shared style is any element that may substitute for kml:AbstractStyleSelectorGroup (kml:Style, kml:StyleMap) that satisfies all of the following conditions:
A custom schema (kml:Schema) may be defined in order to add user-defined data that occurs within a child kml:ExtendedData element of a KML feature.
kmlSource - A Source for reading a KML document.xpath - An XPath (2.0) expression that selects the KML objects of
interest.public static AltitudeMode getAltitudeMode(Element element)
element - A KML element.public static Map<String,net.sf.saxon.s9api.ItemType> getDeclaredFields(net.sf.saxon.s9api.XdmNode schema)
schema - A node representing a kml:Schema element.Copyright © 2016 Open Geospatial Consortium. All rights reserved.