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.
IndexProgramming Questions & HelpSyntax Questions › processing.xml not working
Page Index Toggle Pages: 1
processing.xml not working? (Read 475 times)
processing.xml not working?
Oct 21st, 2007, 7:27pm
 
I am using processing to take xml data from a source and utilise it to change the diameter of a number of cirlces on screen, this works fine when run as an application, or from processing but when used as an applet on a webpage the java console throws up an error saying "cannot create reader?" Is this just a problem with processing.xml or is my code completely screwy!

Code below:

import processing.xml.*;
XMLElement xml;

void setup() {
   size(600, 600);
}


void draw() {
 background(255,255,255);
 xml = new XMLElement(this, "http://arch-os.scce.plymouth.ac.uk/xml_data.php?source=all_vis");
 XMLElement kid = xml.getChild(4).getChild(3);  
 String xmlData = kid.getContent();
 int list[] = int(split(xmlData, ", "));
//print(list[221]);
for (int i = 200; i > 150; i = i-3) {
float a = random(20,255);
int b = int(a);
stroke(20*list[i],200,b);
noFill();
smooth();
ellipse(300, 300, (list[i]*10), (list[i]*10));
}
}
   
 


Re: processing.xml not working?
Reply #1 - Oct 21st, 2007, 7:50pm
 
where are you running the applet from? normally applets can only access the same server they came from ( "sandbox", java security model ). you can work around that by either signing the applet (not so nice), or by using a serverside language like php to grab the remote file and pass it thru to the applet ...

F
Page Index Toggle Pages: 1