()
| 9 | } |
| 10 | |
| 11 | toString() { |
| 12 | // to xml item |
| 13 | let tag = '<' + this.name |
| 14 | let attrKeys = Object.keys(this.attrs) |
| 15 | if (attrKeys.length) { |
| 16 | tag += (' ' + attrKeys.map(key => key + '=' + '"' + this.attrs[key] + '"').join(' ')) |
| 17 | } |
| 18 | |
| 19 | if (this.children.length) { |
| 20 | tag += '>\n' |
| 21 | this.children.forEach(child => { |
| 22 | tag += child.toString() |
| 23 | }) |
| 24 | tag += ('</' + this.name + '>\n') |
| 25 | } else if (this.content) { |
| 26 | tag += ('>' + this.content + '</' + this.name + '>\n') |
| 27 | } else { |
| 28 | tag += '/>\n' |
| 29 | } |
| 30 | return tag |
| 31 | } |
| 32 | |
| 33 | addChild(childInfo) { |
| 34 | if (childInfo && childInfo instanceof SystemBaseInfo) { |
no test coverage detected