Skip to content Skip to sidebar Skip to footer

How To Deal With Xml Parsing For Invalid Character Use In Url For Getting Result

i am able to do xml parsing for valid character but when i pass invalid character from my URL string then there no result found but when i pass that web service url from my browser

Solution 1:

You should use URLEncoder:

String stateselected= URLEncoder.encode(filter.stateselected, "UTF-8");
String cityselected = URLEncoder.encode(filter.cityselected, "UTF-8");
String typeselected= URLEncoder.encode(filter.typeselected, "UTF-8");
String neighbourselected= URLEncoder.encode(filter.neighbourselected, "UTF-8");
String temp = "http://www.arteonline.mobi/iphone/output.php?st="+stateselected+"&ct="+cityselected+"&type="+typeselected+"&neigh="+neighbourselected+"";
//String temp = "http://www.arteonline.mobi/iphone/output.php?st=&ct=&type=Clínicas%20y%20Talleres&neigh=";

if you have problems with the character encoding when parsing the XML you could set the encoding used by the parser:

InputSource is = new InputSource(sourceUrl.openStream());
is.setEncoding("ISO-8859-1");
xr.parse(is);

Post a Comment for "How To Deal With Xml Parsing For Invalid Character Use In Url For Getting Result"