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 & HelpOther Libraries › XMLElement & character encoding
Page Index Toggle Pages: 1
XMLElement & character encoding (Read 383 times)
XMLElement & character encoding
Jan 7th, 2009, 7:06pm
 
i am developing an application which requires XML parsing.
I am using XMLElement to read the xml file.

the sketch is the following code:

XMLElement cursos;

void setup(){
 size(200,200);
 cursos = new XMLElement(this, "http://XXXXXXXXXXXX/getcursosfoz.asp");
 XMLElement[] cursosNode = cursos.getChildren();
 for(int i = 0; i < cursosNode.length; i++){
   println(cursosNode[i].getChildren());
 }
}

the println result comes up with a small error:


[0]   <EstRes>0</EstRes>

[1]   <c1>3910</c1>

[2]   <c2>PG - Direito das Crian&#65533;as</c2>

[3]   <c3>P&#65533;s-Gradua&#65533;&#65533;o</c3>

[4]   <c4>1</c4>

in <c2> the &# xfffd; (used a space between the &# and the chars, bacause the browser was showing them wrong) should be a ç
in <c3>, the first &# xfffd; should be a ó, the second a ç the third ã
yet all come back as &# xfffd; instead of either the characters or the corresponding code for that character.

any thoughts about this error or a possible solution?
this library is preferable to others like ProXML or SimpleML, because i can load diferent XML files and use them in different ways.

Re: XMLElement & character encoding
Reply #1 - Jan 8th, 2009, 12:35am
 
If that's the new native XML support of Processing, the ref. states it supports only UTF-8. So ensure the page is sent in this format. Or read the file and convert it, I saw somebody doing that in this forum.
Re: XMLElement & character encoding
Reply #2 - Jan 8th, 2009, 12:30pm
 
i can't convert it, because it changes all characters that aren't a part of UTF-8 into a code, and that code is always the same, even if the characters are different.
Page Index Toggle Pages: 1