A Pen by G Man

Thumbnail
This awesome code was written by ginil, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright ginil ©
  • HTML
  • CSS
  • JavaScript
    

/*Downloaded from https://www.codeseek.co/ginil/a-pen-by-g-man-JvpYbd */
    


/*Downloaded from https://www.codeseek.co/ginil/a-pen-by-g-man-JvpYbd */
    $(document).ready(function() {
  
  

var text = "<comment>\n<type>usergen</type>\n<text>123123123123</text>\n<user>UCTLB</user>\n<timestamp>Wed, 09 May 2018 06:12:17 GMT</timestamp>\n</comment>";
  debugger;
  var parser = new DOMParser();
		var xmlDoc = parser.parseFromString(text,"text/xml");
		var arr = [];
  var txt = "";
		var x = xmlDoc.getElementsByTagName("comment");
    console.log(x); 
		for (i = 0; i < x.length; i++) {
		    txt += x[i].childNodes[0].nodeValue + "<br>";
       console.log("X" + txt);
		    var arrVal = {
		    	"comment":"testComment goes here",
		    	"who":"uctlb",
		    	"when": new Date()
		    };
		    arr.push(arrVal); 
      //console.log(arrVal);
		}
  
  });

Comments