You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
674 B
JavaScript
23 lines
674 B
JavaScript
class Model {
|
|
constructor() {}
|
|
|
|
parseXML(xml) {
|
|
let parser = new DOMParser();
|
|
let xmlDoc = parser.parseFromString(xml, "text/xml");
|
|
|
|
this.comments = [];
|
|
|
|
let comment = xmlDoc.getElementsByTagName("comment");
|
|
for (let i = 0; i < comment.length; i++) {
|
|
let start = comment[i].getElementsByTagName("start")[0].innerHTML;
|
|
let end = comment[i].getElementsByTagName("end")[0].innerHTML;
|
|
let text = comment[i].getElementsByTagName("text")[0].innerHTML;
|
|
let fulltext = comment[i].getElementsByTagName("fulltext")[0].innerHTML;
|
|
|
|
this.comments.push(new Comment(start, end, text, fulltext));
|
|
}
|
|
|
|
return this.comments;
|
|
}
|
|
}
|