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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user