diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index 9fca0f4b50..ff17920099 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -18,6 +18,7 @@ goog.require('goog.string'); goog.require('ol.Feature'); goog.require('ol.feature'); goog.require('ol.format.XML'); +goog.require('ol.format.XSD'); goog.require('ol.geom.GeometryCollection'); goog.require('ol.geom.GeometryType'); goog.require('ol.geom.LineString'); @@ -395,17 +396,6 @@ ol.format.KML.readNumber_ = function(node) { }; -/** - * @param {Node} node Node. - * @private - * @return {string} String. - */ -ol.format.KML.readString_ = function(node) { - var s = ol.xml.getAllTextContent(node, false); - return goog.string.trim(s); -}; - - /** * @param {Node} node Node. * @private @@ -1070,7 +1060,7 @@ ol.format.KML.SimpleDataParser_ = function(node, objectStack) { goog.asserts.assert(node.localName == 'SimpleData'); var name = node.getAttribute('name'); if (!goog.isNull(name)) { - var data = ol.format.KML.readString_(node); + var data = ol.format.XSD.readString(node); var featureObject = /** @type {Object} */ (objectStack[objectStack.length - 1]); goog.object.set(featureObject, name, data); @@ -1177,7 +1167,7 @@ ol.format.KML.whenParser_ = function(node, objectStack) { */ ol.format.KML.DATA_PARSERS_ = ol.xml.makeParsersNS( ol.format.KML.NAMESPACE_URIS_, { - 'value': ol.xml.makeReplacer(ol.format.KML.readString_) + 'value': ol.xml.makeReplacer(ol.format.XSD.readString) }); @@ -1248,7 +1238,7 @@ ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_ = ol.xml.makeParsersNS( */ ol.format.KML.ICON_PARSERS_ = ol.xml.makeParsersNS( ol.format.KML.NAMESPACE_URIS_, { - 'href': ol.xml.makeObjectPropertySetter(ol.format.KML.readString_) + 'href': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString) }); @@ -1334,7 +1324,7 @@ ol.format.KML.OUTER_BOUNDARY_IS_PARSERS_ = ol.xml.makeParsersNS( ol.format.KML.PAIR_PARSERS_ = ol.xml.makeParsersNS( ol.format.KML.NAMESPACE_URIS_, { 'Style': ol.xml.makeObjectPropertySetter(ol.format.KML.readStyle_), - 'key': ol.xml.makeObjectPropertySetter(ol.format.KML.readString_), + 'key': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), 'styleUrl': ol.xml.makeObjectPropertySetter(ol.format.KML.readStyleUrl_) }); @@ -1359,11 +1349,11 @@ ol.format.KML.PLACEMARK_PARSERS_ = ol.xml.makeParsersNS( ol.format.KML.readPolygon_, 'geometry'), 'Style': ol.xml.makeObjectPropertySetter(ol.format.KML.readStyle_), 'StyleMap': ol.format.KML.StyleMapParser_, - 'address': ol.xml.makeObjectPropertySetter(ol.format.KML.readString_), - 'description': ol.xml.makeObjectPropertySetter(ol.format.KML.readString_), - 'name': ol.xml.makeObjectPropertySetter(ol.format.KML.readString_), + 'address': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), + 'description': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), + 'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), 'open': ol.xml.makeObjectPropertySetter(ol.format.KML.readBoolean_), - 'phoneNumber': ol.xml.makeObjectPropertySetter(ol.format.KML.readString_), + 'phoneNumber': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), 'styleUrl': ol.xml.makeObjectPropertySetter(ol.format.KML.readURI_), 'visibility': ol.xml.makeObjectPropertySetter(ol.format.KML.readBoolean_) }, ol.xml.makeParsersNS( @@ -1661,7 +1651,7 @@ ol.format.KML.prototype.readNameFromNode = function(node) { if (goog.array.indexOf(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) != -1 && n.localName == 'name') { - return ol.format.KML.readString_(n); + return ol.format.XSD.readString(n); } } for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {