@Test public void testProperties() throws Exception { XmlPullParser xmlPullParser = createParser("amu_multigeometry_placemarks.kml"); KmlPlacemark placemark = KmlFeatureParser.createPlacemark(xmlPullParser); assertTrue(placemark.hasProperties()); assertEquals(placemark.getProperty("name"), "Placemark Test"); assertNull(placemark.getProperty("description")); }
static KmlPlacemark createPlacemark(XmlPullParser parser) throws IOException, XmlPullParserException { String styleId = null; KmlStyle inlineStyle = null; HashMap<String, String> properties = new HashMap<String, String>(); Geometry geometry = null; int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals("Placemark"))) { if (eventType == START_TAG) { if (parser.getName().equals(STYLE_URL_TAG)) { styleId = parser.nextText(); } else if (parser.getName().matches(GEOMETRY_REGEX)) { geometry = createGeometry(parser, parser.getName()); } else if (parser.getName().matches(PROPERTY_REGEX)) { properties.put(parser.getName(), parser.nextText()); } else if (parser.getName().equals(EXTENDED_DATA)) { properties.putAll(setExtendedDataProperties(parser)); } else if (parser.getName().equals(STYLE_TAG)) { inlineStyle = KmlStyleParser.createStyle(parser); } } eventType = parser.next(); } return new KmlPlacemark(geometry, styleId, inlineStyle, properties); }
KmlFeatureParser { static KmlPlacemark createPlacemark(XmlPullParser parser) throws IOException, XmlPullParserException { String styleId = null; KmlStyle inlineStyle = null; HashMap<String, String> properties = new HashMap<String, String>(); Geometry geometry = null; int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals("Placemark"))) { if (eventType == START_TAG) { if (parser.getName().equals(STYLE_URL_TAG)) { styleId = parser.nextText(); } else if (parser.getName().matches(GEOMETRY_REGEX)) { geometry = createGeometry(parser, parser.getName()); } else if (parser.getName().matches(PROPERTY_REGEX)) { properties.put(parser.getName(), parser.nextText()); } else if (parser.getName().equals(EXTENDED_DATA)) { properties.putAll(setExtendedDataProperties(parser)); } else if (parser.getName().equals(STYLE_TAG)) { inlineStyle = KmlStyleParser.createStyle(parser); } } eventType = parser.next(); } return new KmlPlacemark(geometry, styleId, inlineStyle, properties); } }
KmlFeatureParser { static KmlPlacemark createPlacemark(XmlPullParser parser) throws IOException, XmlPullParserException { String styleId = null; KmlStyle inlineStyle = null; HashMap<String, String> properties = new HashMap<String, String>(); Geometry geometry = null; int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals("Placemark"))) { if (eventType == START_TAG) { if (parser.getName().equals(STYLE_URL_TAG)) { styleId = parser.nextText(); } else if (parser.getName().matches(GEOMETRY_REGEX)) { geometry = createGeometry(parser, parser.getName()); } else if (parser.getName().matches(PROPERTY_REGEX)) { properties.put(parser.getName(), parser.nextText()); } else if (parser.getName().equals(EXTENDED_DATA)) { properties.putAll(setExtendedDataProperties(parser)); } else if (parser.getName().equals(STYLE_TAG)) { inlineStyle = KmlStyleParser.createStyle(parser); } } eventType = parser.next(); } return new KmlPlacemark(geometry, styleId, inlineStyle, properties); }  }
KmlFeatureParser { static KmlPlacemark createPlacemark(XmlPullParser parser) throws IOException, XmlPullParserException { String styleId = null; KmlStyle inlineStyle = null; HashMap<String, String> properties = new HashMap<String, String>(); Geometry geometry = null; int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals("Placemark"))) { if (eventType == START_TAG) { if (parser.getName().equals(STYLE_URL_TAG)) { styleId = parser.nextText(); } else if (parser.getName().matches(GEOMETRY_REGEX)) { geometry = createGeometry(parser, parser.getName()); } else if (parser.getName().matches(PROPERTY_REGEX)) { properties.put(parser.getName(), parser.nextText()); } else if (parser.getName().equals(EXTENDED_DATA)) { properties.putAll(setExtendedDataProperties(parser)); } else if (parser.getName().equals(STYLE_TAG)) { inlineStyle = KmlStyleParser.createStyle(parser); } } eventType = parser.next(); } return new KmlPlacemark(geometry, styleId, inlineStyle, properties); }   }
KmlFeatureParser { static KmlPlacemark createPlacemark(XmlPullParser parser) throws IOException, XmlPullParserException { String styleId = null; KmlStyle inlineStyle = null; HashMap<String, String> properties = new HashMap<String, String>(); Geometry geometry = null; int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals("Placemark"))) { if (eventType == START_TAG) { if (parser.getName().equals(STYLE_URL_TAG)) { styleId = parser.nextText(); } else if (parser.getName().matches(GEOMETRY_REGEX)) { geometry = createGeometry(parser, parser.getName()); } else if (parser.getName().matches(PROPERTY_REGEX)) { properties.put(parser.getName(), parser.nextText()); } else if (parser.getName().equals(EXTENDED_DATA)) { properties.putAll(setExtendedDataProperties(parser)); } else if (parser.getName().equals(STYLE_TAG)) { inlineStyle = KmlStyleParser.createStyle(parser); } } eventType = parser.next(); } return new KmlPlacemark(geometry, styleId, inlineStyle, properties); }    }