Move readFromDocument implementation to the base class

All the child classes have the same code; move to the base class
This commit is contained in:
Frederic Junod
2020-04-06 16:32:50 +02:00
parent 3014b68254
commit 484f45fc1b
4 changed files with 8 additions and 41 deletions

View File

@@ -33,19 +33,6 @@ class OWS extends XML {
super();
}
/**
* @param {Document} doc Document.
* @return {Object} Object
*/
readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(/** @type {Element} */ (n));
}
}
return null;
}
/**
* @param {Element} node Node.
* @return {Object} Object

View File

@@ -62,19 +62,6 @@ class WMSCapabilities extends XML {
this.version = undefined;
}
/**
* @param {Document} doc Document.
* @return {Object} Object
*/
readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(/** @type {Element} */ (n));
}
}
return null;
}
/**
* @param {Element} node Node.
* @return {Object} Object

View File

@@ -52,19 +52,6 @@ class WMTSCapabilities extends XML {
this.owsParser_ = new OWS();
}
/**
* @param {Document} doc Document.
* @return {Object} Object
*/
readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(/** @type {Element} */ (n));
}
}
return null;
}
/**
* @param {Element} node Node.
* @return {Object} Object

View File

@@ -31,11 +31,17 @@ class XML {
}
/**
* @abstract
* @param {Document} doc Document.
* @return {Object} Object
*/
readFromDocument(doc) {}
readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(/** @type {Element} */ (n));
}
}
return null;
}
/**
* @abstract