Skip to content

Commit 17e7192

Browse files
committed
add 2 default csw namespaces
1 parent 8395dba commit 17e7192

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

endpoints.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ export const cswEndPoints = [
33
{name: "nationaalgeoregister", url: "https://nationaalgeoregister.nl/geonetwork/srv/dut/csw-inspire"},
44
{name: "linz", url: "https://data.linz.govt.nz/services/csw?service=CSW&version=2.0.2&request=GetRecords"},
55
{name: "geo-solutions", url: "https://gs-stable.geo-solutions.it/geoserver/csw"},
6-
{name: "ign-fr", url: "https://data.geopf.fr/csw"},
6+
{name: "geoplatforme.fr", url: "https://data.geopf.fr/csw"},
7+
{name: "ign-fr", url: "https://wxs.ign.fr/catalogue/csw-inspire/"}
78
]

parsexml.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ function getNamespaces(xmlDoc) {
104104
// Start the traversal from the document's root element
105105
traverseElement(xmlDoc.documentElement);
106106

107+
// add csw namespaces
108+
if (!namespaces.xs) {
109+
namespaces.xs = 'http://www.w3.org/2001/XMLSchema';
110+
}
111+
if (!namespaces.ows) {
112+
namespaces.ows = 'http://www.opengis.net/ows';
113+
}
114+
107115
// Cache the result for future calls with the same xmlDoc
108116
prevXmlDoc = xmlDoc;
109117
cachedNamespaces = namespaces;
@@ -116,9 +124,6 @@ export const evaluateXPath = (xmlDoc, expression, returnType) => {
116124
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
117125
// Node.js environment
118126
const namespaces = getNamespaces(xmlDoc);
119-
if (!namespaces.xs) {
120-
namespaces.xs = 'http://www.w3.org/2001/XMLSchema';
121-
}
122127
const select = xpath.useNamespaces(namespaces);
123128
return select(expression, xmlDoc, returnType); // Note: returnType handling might differ
124129
} else {

0 commit comments

Comments
 (0)