display comments from xml

This commit is contained in:
2021-01-27 00:17:59 +01:00
parent 9d8acd5e03
commit ffc9352f91
3 changed files with 57 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ class Model {
let parser = new DOMParser();
let xmlDoc = parser.parseFromString(xml, "text/xml");
let comments = [];
this.comments = [];
let comment = xmlDoc.getElementsByTagName("comment");
for (let i = 0; i < comment.length; i++) {
@@ -14,9 +14,9 @@ class Model {
let text = comment[i].getElementsByTagName("text")[0].innerHTML;
let fulltext = comment[i].getElementsByTagName("fulltext")[0].innerHTML;
comments.push(new Comment(start, end, text, fulltext));
this.comments.push(new Comment(start, end, text, fulltext));
}
return comments;
return this.comments;
}
}