From f06adff56c2af0300847e21107b7d8fb08719358 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 10 Feb 2014 16:13:46 +0100 Subject: [PATCH] Add ol.format.XSD.readNonNegativeIntegerString function --- src/ol/format/xsdformat.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ol/format/xsdformat.js b/src/ol/format/xsdformat.js index 69056e2dc5..058cedd1f9 100644 --- a/src/ol/format/xsdformat.js +++ b/src/ol/format/xsdformat.js @@ -97,7 +97,16 @@ ol.format.XSD.readDecimalString = function(string) { */ ol.format.XSD.readNonNegativeInteger = function(node) { var s = ol.xml.getAllTextContent(node, false); - var m = /^\s*(\d+)\s*$/.exec(s); + return ol.format.XSD.readNonNegativeIntegerString(s); +}; + + +/** + * @param {string} string String. + * @return {number|undefined} Non negative integer. + */ +ol.format.XSD.readNonNegativeIntegerString = function(string) { + var m = /^\s*(\d+)\s*$/.exec(string); if (m) { return parseInt(m[1], 10); } else {