From e73fa28a6eb051a7573d53405ea0dc744dd1c4f3 Mon Sep 17 00:00:00 2001 From: brentfraser Date: Thu, 16 Apr 2020 21:41:15 -0600 Subject: [PATCH] fix parsing errors --- src/Format/Format.GML.js | 2 +- src/Format/Scheme.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Format/Format.GML.js b/src/Format/Format.GML.js index e46c470..9811b0f 100644 --- a/src/Format/Format.GML.js +++ b/src/Format/Format.GML.js @@ -27,7 +27,7 @@ L.Format.GML = L.Format.Base.extend({ var featureCollection = xmlDoc.documentElement; var featureMemberNodes = featureCollection.getElementsByTagNameNS(L.XmlUtil.namespaces.gml, 'featureMember'); for (var i = 0; i < featureMemberNodes.length; i++) { - var feature = featureMemberNodes[i].firstChild; + var feature = featureMemberNodes[i].firstElementChild; layers.push(this.processFeature(feature)); } diff --git a/src/Format/Scheme.js b/src/Format/Scheme.js index 9302848..34bfef3 100644 --- a/src/Format/Scheme.js +++ b/src/Format/Scheme.js @@ -36,7 +36,13 @@ L.Format.Scheme = L.Class.extend({ var typeAttr = node.attributes.type; if (!typeAttr) { var restriction = node.getElementsByTagNameNS(L.XmlUtil.namespaces.xsd, 'restriction'); - typeAttr = restriction.attributes.base; + if (restriction.hasOwnProperty('attributes')) { + typeAttr = restriction.attributes.base; + } else if (restriction.length === 1) { + typeAttr = restriction[0].attributes.base; + } else { + console.log('cannot parse restriction'); + } } if (!typeAttr) {