From f6629fae6c92566b654ae6216e12f31949919a8e Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 10 Feb 2014 16:13:34 +0100 Subject: [PATCH] Add ol.format.XSD.readDecimalString function --- src/ol/format/xsdformat.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ol/format/xsdformat.js b/src/ol/format/xsdformat.js index cf38bb5ab7..69056e2dc5 100644 --- a/src/ol/format/xsdformat.js +++ b/src/ol/format/xsdformat.js @@ -71,9 +71,18 @@ ol.format.XSD.readDateTime = function(node) { * @return {number|undefined} Decimal. */ ol.format.XSD.readDecimal = function(node) { - // FIXME check spec var s = ol.xml.getAllTextContent(node, false); - var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(s); + return ol.format.XSD.readDecimalString(s); +}; + + +/** + * @param {string} string String. + * @return {number|undefined} Decimal. + */ +ol.format.XSD.readDecimalString = function(string) { + // FIXME check spec + var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string); if (m) { return parseFloat(m[1]); } else {