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 tittle = comment[i].getElementsByTagName("tittle")[0].innerHTML;
      let text = comment[i].getElementsByTagName("text");

      this.comments.push(new Comment(start, end, tittle, text));
    }

    return this.comments;
  }
}
