We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
xml (Read 643 times)
xml
Aug 20th, 2007, 8:29pm
 
hi,

I am new to this so excuse my nubieness..

I would like to know how to select a random element from an xml file then display it using text()

Also..to avoid displaying the same element twice until all elements have been displayed once.

I have read and tried the XMLElement Class examples..but no luck.

thank you for your help!

Chris.
Re: xml
Reply #1 - Aug 22nd, 2007, 5:46pm
 
read them all into a string array, shuffle them (Knuth shuffle? java.util.Collections.shuffle()?), display them sequentially. at end of array reshuffle them and start again?

requires the text fragments to be in memory all the time which could be a problem if there are a lot of them. maybe store a reference only and use that to reparse the xml before display.
Page Index Toggle Pages: 1