Skip to content

Instantly share code, notes, and snippets.

@picacure
Last active October 7, 2015 18:17
Show Gist options
  • Save picacure/3205149 to your computer and use it in GitHub Desktop.
Save picacure/3205149 to your computer and use it in GitHub Desktop.
Parser
<script type="text/javascript">
xmlDoc=loadXMLDoc("/example/xdom/books.xml");
x=xmlDoc.getElementsByTagName('book')[0];
cloneNode=x.cloneNode(true);
xmlDoc.documentElement.appendChild(cloneNode);
//Output all titles
y=xmlDoc.getElementsByTagName("title");
for (i=0;i<y.length;i++)
{
document.write(y[i].childNodes[0].nodeValue);
document.write("<br />");
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment