From e3deb03e71a79ae3891661bbe89006360c14be9e Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 10 Feb 2014 16:13:12 +0100 Subject: [PATCH] Add ol.format.XSD.readBooleanString 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 9d52f36d38..cf38bb5ab7 100644 --- a/src/ol/format/xsdformat.js +++ b/src/ol/format/xsdformat.js @@ -17,7 +17,16 @@ ol.format.XSD.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema'; */ ol.format.XSD.readBoolean = function(node) { var s = ol.xml.getAllTextContent(node, false); - var m = /^\s*(true|1)|(false|0)\s*$/.exec(s); + return ol.format.XSD.readBooleanString(s); +}; + + +/** + * @param {string} string String. + * @return {boolean|undefined} Boolean. + */ +ol.format.XSD.readBooleanString = function(string) { + var m = /^\s*(true|1)|(false|0)\s*$/.exec(string); if (m) { return goog.isDef(m[1]) || false; } else {