# XML News reader

**URL:** <https://forum.kirupa.com/t/xml-news-reader/112427>\
**Category:** Uncategorized\
**Created:** [June 7, 2004, 6:51pm UTC](https://forum.kirupa.com/t/xml-news-reader/112427 "2004-06-07T18:51:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![muddymac](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@muddymac](https://forum.kirupa.com/u/muddymac)\
**Post date:** [June 7, 2004, 6:51pm UTC](https://forum.kirupa.com/t/xml-news-reader/112427/1 "2004-06-07T18:51:52Z")

</div>

What I’m trying to put together is a multi-news reader from one XML file, below is my code. Now what I can’t figure out is how to cycle from one block to the next using buttons(or MC’s as buttons), I’m trying to get the news in blocks, so button 1 is news1, button2 is news2, etc…, so the current XML is correct and reads fine, I am trying to add more blocks, which would be another subset, I hope I’m making sense.

```
          for (var n = 0; n &lt;

```

newsXML.firstChild.childNodes.length; n++) {  
for (var n2 = 0; n2 \<  
newsXML.firstChild.childNodes.length; n2++) {  
if(newsXML.firstChild.childNodes[n].childNodes[n2].firstChild.nodeName  
= “date”) {  
articlesTXT.text = articlesTXT.text +newsXML.firstChild.childNodes[n].childNodes[n2].firstChild.nodeValue

- "  
";  
}  
else {  
articlesTXT.text = articlesTXT.text +

newsXML.firstChild.childNodes[n].childNodes[n2].firstChild.nodeValue

- "  
";  
}  
}  
}  
}

My XML looks like this.

\<?xml version=“1.0” encoding=“UTF-8” ?

\<news\>  
\<article\>  
\<date5/30/2004\</date\>  
\<content\>TEXT\</content\>  
\</article.  
\<article.  
\<date\>5/29/2004\</date\>  
\<content\>TEXT\</content\>  
\</article\>  
\<article\>  
\<date\>5/31/2004\</date.  
\<content\>TEXT\</content\>  
\</article\>  
\</news\>

\<news2\>  
\<article\>  
\<date5/30/2004\</date\>  
\<content\>TEXT\</content\>  
\</article.  
\<article.  
\<date\>5/29/2004\</date\>  
\<content\>TEXT\</content\>  
\</article\>  
\<article\>  
\<date\>5/31/2004\</date.  
\<content\>TEXT\</content\>  
\</article\>  
\</news2\>

and so on…
