Hi there,
First time poster, so don't be too harsh :) !
I've recently tried to write a program incorporating proXML and would like to extend it to the GoogleAPI if possible, but I digress. My basic problem is that I can display everything from an XML document in the prompt window but not in the applet window, which I can only get one line.
My code may seem illogical at first as I have essentially modified (albeit heavily) the example from the proXML site. Apologies for the heavy commenting (bad habit)
-----------------------------------------------------------------
Code:
//import packages
import proxml.*;
//proXML reqs
XMLElement feeds;
XMLInOut xmlInOut;
//setup method
void setup()
{
size(640,400);
smooth();
background(102);
//load fonts
PFont font = loadFont("Verdana-10.vlw");
textFont(font, 10);
//load feeds from file if it exists
try
{
xmlInOut = new XMLInOut(this);
//test with BBC E Commerce website
feeds = xmlInOut.loadElementFrom("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/business/rss.xml");
for (int x=0 ; x<=feeds.countAllChildren(); x++)
{
text(feeds.toString(),15,20);
}
initFeeds();
}
catch(InvalidDocumentException ide)
{
println("Bad Link");
}
}
void draw()
{
}
void initFeeds()
{
//test to make sure that the xml file is read fully
feeds.printElementTree(" "," ");
}
This displays the whole XML document in the prompt but only the first line in the applet window.
Now I know the problem is with my for loop in the setup, but I can't simply replace the toString with the printElementTree.
Eventually, I want to be able to pull only specific tags out of the whole document and only have the news headings displayed as clickable links, but firstly I need to be able to display the document first!
Apologies for the long code.
Thanks for anyone who can help.