From b1d298f64241e45f360d971b4285f4a33fe3c689 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 12 Dec 2024 16:14:57 +0100 Subject: [PATCH] Additional namespace should only be loaded if the XML is missing them. The XML file should define all namespaces that you need, but we do checks on XML files using namespaces unknown to that file (such as OWS checks on a GetFeature action). In these instances we need to supplement the namespacemanager because the XML scheme doesn't -correctly- define them. BUT: if you define a namespace with a URL that is different from the one defined in the XML file, then it will stop working correctly and refuse to load the XML file and/or apply XPath queries correctly --- .../DataTypeAdapters/WFSGeoJSONImportAdapter.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Layers/Adapters/DataTypeAdapters/WFSGeoJSONImportAdapter.cs b/Assets/Scripts/Layers/Adapters/DataTypeAdapters/WFSGeoJSONImportAdapter.cs index cbce7902..ee40c71f 100644 --- a/Assets/Scripts/Layers/Adapters/DataTypeAdapters/WFSGeoJSONImportAdapter.cs +++ b/Assets/Scripts/Layers/Adapters/DataTypeAdapters/WFSGeoJSONImportAdapter.cs @@ -358,8 +358,14 @@ private XmlNamespaceManager ReadNameSpaceManager(XmlDocument xmlDocument) { XmlNamespaceManager namespaceManager = new(xmlDocument.NameTable); XmlNodeList elementsWithNamespaces = xmlDocument.SelectNodes("//*"); - namespaceManager.AddNamespace("wfs", "http://www.opengis.net/wfs"); - namespaceManager.AddNamespace("ows", "http://www.opengis.net/ows"); + if (namespaceManager.HasNamespace("wfs") == false) + { + namespaceManager.AddNamespace("wfs", "http://www.opengis.net/wfs"); + } + if (namespaceManager.HasNamespace("ows") == false) + { + namespaceManager.AddNamespace("ows", "http://www.opengis.net/ows/1.1"); + } if (elementsWithNamespaces != null) {