|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
[Java] Connessione ad un web service e parsing dell'XML ricevuto, AIUTO !!!
Ciao,
stò letteralmente impazzendo con un progetto universitario. Praticamente ho un'applicazione Android che si deve connettere ad un WS da cui riceve un file XML (ma non vi preoccupate, si tratta di Java standard, anzi la parte della classe relativa ad Android non la pubblico neanche, questo codice potrebbe essere schiaffato identico in una qualsiasi normalissima applicazione Java). In pratica la classe GuidaSubActivity effettua una connessione ad un mio web service passandogli 3 parametri: una latitudine, una longitudine ed un range (che è stato scritto in Java Spring), il WS gli restituisce un file XML contenente dei dati che devono essere parsati. I dati in questione contenuti nell'XML rappresentano una lista di punti di interesse dove ogni punto di interesse ha determinati campi come: longitudine, latitudine, nome, descrizione. Il parsing consiste semplicemente nello scorrere questo file XML contenente questi punti di interesse, e di mettere i valori dei campi di ogni punto di interesse presenti nell'XML in un oggetto POI (che rappresenta un punto di interesse) al fine di creare una lista di POI Il WS funziona più che correttamente: posso invocarne il relativo metodo passandogli la latitudine, longitudine e range sia dal browser sia usando SoapUI e tutto funziona benone... Stò incontrando però grossissimi problemi però a creare la connessione con il WS ed a parsare l'XML ricevuto. Vi spiego cosa ho fatto: 1) Nella classe GuidaSubActivity della mia applicazione ho il metodo getPois() che si connette al WS da cui ottiene la lista di punti di interesse, il codice di tale metodo è il seguente: Codice:
//metodo che chiama il WS
public List<Poi> getPois(String userLon, String userLat, String userRange){
/* Loggo l'entrata nel metodo getPois() che effettua la chiamata al web service ed i parametri ricevuti */
Log.d("Sono appena entrato nel metodo getPois() ed i parametri passati sono, userLon:", userLon);
Log.d("userLon: ", userLon);
Log.d("userLat: ", userLat);
Log.d("userRange: ", userRange);
List<Poi> pois = null;
//Log.d("pois punta a: ", pois.toString());
Toast.makeText(this, "Loading POIs..", Toast.LENGTH_LONG).show();
String soapRequest = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:exam=\"http://example\">\n" +
" <soapenv:Header/>\n" +
" <soapenv:Body>\n" +
" <exam:getRangePoi>\n" +
" <exam:lon>"+userLon+"</exam:lon>\n" +
" <exam:lat>"+userLat+"</exam:lat>\n" +
" <exam:range>"+userRange+"</exam:range>\n" +
" </exam:getRangePoi>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
Log.d("Ho messo il seguente XML con parametri dinamici nella variabile soapRequest", soapRequest);
String soapAction = "";
Log.d("La soap action vale: ", soapAction.toString());
StringBuffer buffer = sendSoapRequest(soapRequest, soapAction);
Log.d("Mette nel buffer il risultato restituito da sendSoapRequest: ", buffer.toString());
try{
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
Log.d("Crea il parser che punta all'oggetto con indirizzo: ", parser.toString());
// System.out.println(buffer.toString()); // Che è sta robba ?!?! booo pussa viaaa !!!
StringReader sr = new StringReader(buffer.toString());
Log.d("E' stato creato uno StringReader sr e passagli il contenuto del buffer in forma di stringa", sr.toString());
InputSource is = new InputSource(sr);
Log.d("E' stato creato un oggetto InputSource is a cui viene passato il riferimento all'oggetto sr ", is.toString());
PoiSaxHandler handler = new PoiSaxHandler();
Log.d("E' stato creato l'oggetto handler di tipo PoiSaxHandler", handler.toString());
// ATTENZIONEEE NON EFFETTUA IL PARSING !!!
parser.parse(is,handler);
Log.d("Passo al parser l'oggetto is che è:", is.toString());
Log.d("Passo al pareser l'oggetto handler che è: ", handler.toString());
pois = handler.getPois(); // NB: Variabile dichiarata all'inizio del metodo
Log.d("Invoco il metodo getPois sull'oggetto handler", "suka");
System.out.println("HttpClient.main pois "+pois.toString());
}catch(Exception e){
}
Log.d("MioProgramma", pois.toString());
return pois;
}
Praticamente questo metodo: riceve come parametri di input la longitudine e la latitudine in cui si trova l'utente ed un certo range e deve restituire al chiamante una lista di oggetti Poi che contiene tutti i punti di interesse entro un certo range kilometrico centrato sulla posizione dell'utente, la lista viene restituita appunto dal WS. Come prima cosa dichiara una lista di generici oggetti Poi che punta inizialmente a null. Questa è la variabile che dovrà in fine essere restituita dal metodo in questione. Poi dichiaro una variabile di tipo String chiamata soapRequest che contiene appunto la richiesta soap generata con soapUI. La richiesta soap è in forma XML ed ho fatto in modo da rendere dinamici i parametri userLon, userLat ed userRange. Dovrebbe essere correttissima !!! Infatti la loggo e mi pare di vederla corretta nei Log di Android (eventualmente basta fare un println) Poi ho definito una variabile soapAction vuota perchè in questa richiesta al WS non ho bisogno di una Soap Action. Poi creo una variabile StringBuffer buffer in cui metto il risultato ritornato dal metodo sendSoapRequest che come parametri prende la soapRequest e la soapAction precedentemente create e restituisce credo l'XML da parsare ricevuto dal WS, ecco quì il risultato loggato (non fate caso ai valori messi...hanno nome a cavolo perchè nel DB ho inserito punti con nomi e dati a cavolo ma mi pare essere corretto) Codice:
10-29 17:51:03.547: DEBUG/Mette nel buffer il risultato restituito da sendSoapRequest:(322): <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><getRangePoiResponse xmlns="http://example"><getRangePoiReturn><getRangePoiReturn xsi:type="ns1:Map" xmlns:ns1="http://xml.apache.org/xml-soap"><item xmlns=""><key xsi:type="xsd:string">WikiLink</key><value xsi:type="xsd:string">link 2</value></item><item xmlns=""><key xsi:type="xsd:string">Alt</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Tipologia</key><value xsi:type="xsd:int">0</value></item><item xmlns=""><key xsi:type="xsd:string">Distance</key><value xsi:type="xsd:double">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Lat</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Id</key><value xsi:type="xsd:int">3</value></item><item xmlns=""><key xsi:type="xsd:string">Lon</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Nome</key><value xsi:type="xsd:string">test 2</value></item></getRangePoiReturn><getRangePoiReturn xsi:type="ns2:Map" xmlns:ns2="http://xml.apache.org/xml-soap"><item xmlns=""><key xsi:type="xsd:string">WikiLink</key><value xsi:type="xsd:string">lll</value></item><item xmlns=""><key xsi:type="xsd:string">Alt</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Tipologia</key><value xsi:type="xsd:int">0</value></item><item xmlns=""><key xsi:type="xsd:string">Distance</key><value xsi:type="xsd:double">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Lat</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Id</key><value xsi:type="xsd:int">13</value></item><item xmlns=""><key xsi:type="xsd:string">Lon</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Nome</key><value xsi:type="xsd:string">aaab</value></item></getRangePoiReturn><getRangePoiReturn xsi:type="ns3:Map" xmlns:ns3="http://xml.apache.org/xml-soap"><item xmlns=""><key xsi:type="xsd:string">WikiLink</key><value xsi:type="xsd:string">lll</value></item><item xmlns=""><key xsi:type="xsd:string">Alt</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Tipologia</key><value xsi:type="xsd:int">0</value></item><item xmlns=""><key xsi:type="xsd:string">Distance</key><value xsi:type="xsd:double">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Lat</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Id</key><value xsi:type="xsd:int">12</value></item><item xmlns=""><key xsi:type="xsd:string">Lon</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Nome</key><value xsi:type="xsd:string">jiji</value></item></getRangePoiReturn><getRangePoiReturn xsi:type="ns4:Map" xmlns:ns4="http://xml.apache.org/xml-soap"><item xmlns=""><key xsi:type="xsd:string">WikiLink</key><value xsi:type="xsd:string"></value></item><item xmlns=""><key xsi:type="xsd:string">Alt</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Tipologia</key><value xsi:type="xsd:int">0</value></item><item xmlns=""><key xsi:type="xsd:string">Distance</key><value xsi:type="xsd:double">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Lat</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Id</key><value xsi:type="xsd:int">11</value></item><item xmlns=""><key xsi:type="xsd:string">Lon</key><value xsi:type="xsd:float">0.0</value></item><item xmlns=""><key xsi:type="xsd:string">Nome</key><value xsi:type="xsd:string">POITest222</value></item></getRangePoiReturn><getRangePoiReturn xsi:type="ns5:Map" xmlns:ns5="http://xml.apache.org/xml-soap"><item xmlns=""><key xsi:type="xsd:string">WikiLink</key><value xsi:type="x Poi creo gli oggetti StringReader sr ed InputSource is ed anche questi li loggo e dovrebbero essere ok Con la seguente riga di codice creo il mio handler personale che dovrebbe essere l'oggetto che contiene le regole per parsare il mio XML (almeno da quanto ho capito...mi date conferma? non ho fatto tutto io, è un progetto di gruppo) Codice:
PoiSaxHandler handler = new PoiSaxHandler(); Codice:
parser.parse(is,handler); In realtà appaiono dei messaggi di log che ho fatto nel codice dell'handler...quindi pare che in qualche modo l'handler faccia qualcosa e pare evidente che si vada ad inchiodare da qualche parte dentro l'handler. Il codice della classe PoiSaxHandler è il seguente: Codice:
package mieapplicazioni.Http;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
public final class PoiSaxHandler extends DefaultHandler {
private boolean isId;
private boolean isLat;
private boolean isLon;
private boolean isAlt;
private boolean isTipologia;
private boolean isWiki;
private boolean isPoiId;
private boolean isNome;
private int cicle=0;
// invoked when document-parsing is started:
public void startDocument() throws SAXException {
System.out.println("Document processing started");
}
private Poi p = null;
private List<Poi> pois=new ArrayList<Poi>();
private String currentElement = null;
// notifies about finish of parsing:
public void endDocument() throws SAXException {
pois.add(p);
System.out.println("Document processing finished");
}
// we enter to element 'qName':
public void startElement(String uri, String localName,
String qName, Attributes attrs) throws SAXException {
String key="";
if (qName.equals("soapenv:Envelope")) {
currentElement=qName;
} else if (qName.equals("soapenv:Body")) {
currentElement=qName;
System.out.println("SimpleSaxHandler$SaxHandler.startElement body");
} else if (qName.equals("listPoiReturn"))
{
currentElement=qName;
//System.out.println("SimpleSaxHandler$SaxHandler.startElement listPois");
}
else if(qName.equals("getRangePoiResponse"))
{
currentElement=qName;
}
else if(qName.equals("getRangePoiReturn"))
{
currentElement=qName;
System.out.println("PoiSaxHandler.startElement "+attrs.getLocalName(0));
if(attrs.getLocalName(0)!=null&&attrs.getLocalName(0).equals("xsi:type"))
{
//System.out.println("SimpleSaxHandler$SaxHandler.startElement nuovo pois");
if(cicle==0)
p=new Poi();
else{
pois.add(p);
p=new Poi();
}
cicle++;
}
}
else if (qName.equals("item"))
{
currentElement=qName;
}
else if (qName.equals("key"))
{
currentElement=qName;
//System.out.println("SimpleSaxHandler$SaxHandler "+currentElement);
//System.out.println("SimpleSaxHandler$SaxHandler.startElement key "+key);
}
else if (qName.equals("value"))
{
currentElement=qName;
//System.out.println("SimpleSaxHandler$SaxHandler.startElement value di "+key+" -->"+attrs.getQName(0));
}
else {
throw new IllegalArgumentException("Element '" +
qName + "' is not allowed here");
}
}
// we leave element 'qName' without any actions:
public void endElement(String uri, String localName, String qName)
throws SAXException {
//System.out.println("SimpleSaxHandler$SaxHandler.endElement "+qName);
}
public void characters(char ch[], int start, int length)
throws SAXException {
if(currentElement.equals("key")&&(new String(ch, start, length).equals("Id")))
isId=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Lat")))
isLat=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Lon")))
isLon=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Alt")))
isAlt=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Tipologia")))
isTipologia=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Nome")))
isNome=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Wikilink")))
isWiki=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Distance")))
isPoiId=true;
//System.out.println("currentElement: "+currentElement+" -->"+ new String(ch, start, length));
if (isId&¤tElement.equals("value")) {
p.setId(Long.parseLong(new String(ch, start, length)));
System.out.println("id: "
+ new String(ch, start, length));
isId=false;
}else if (isLat&¤tElement.equals("value")) {
p.setLat(Float.parseFloat(new String(ch, start, length)));
System.out.println("lat: "
+ new String(ch, start, length));
isLat=false;
}else if (isLon&¤tElement.equals("value")) {
p.setLon(Float.parseFloat(new String(ch, start, length)));
System.out.println("lon: "
+ new String(ch, start, length));
isLon=false;
}
else if(currentElement.equals("value")&&(isAlt))
{
p.setAlt(Float.parseFloat(new String(ch, start, length)));
System.out.println("alt: "
+ new String(ch, start, length));
isAlt=false;;
}
else if(currentElement.equals("value")&&(isTipologia))
{
String sTipologia=new String(ch, start, length);
int tipologia=0;
if(sTipologia!=null&&!sTipologia.equals(""))
tipologia=Integer.parseInt(sTipologia);
p.setTipologia(tipologia);
System.out.println("Tipologia: "
+ new String(ch, start, length));
isTipologia=false;
}
else if(currentElement.equals("value")&&(isNome))
{
p.setNome(new String(ch, start, length));
System.out.println("Nome: "
+ new String(ch, start, length));
isNome=false;
}
else if(currentElement.equals("value")&&(isWiki))
{
p.setWikilynk(new String(ch, start, length));
System.out.println("Wiki: "
+ new String(ch, start, length));
isWiki=false;
}
else if(currentElement.equals("value")&&(isPoiId))
{
String sPoiId=new String(ch, start, length);
Long poiId=0L;
//if(sPoiId!=null&&!sPoiId.trim().equals(""))
//poiId=Long.parseLong(sPoiId);
p.setPoiId(sPoiId);
System.out.println("PoiId: "
+ new String(ch, start, length));
isPoiId=false;
}
}
public List<Poi> getPois() {
//Log.d("Sono entranto nel metodo getPois dentro la classe PoiSaxHandler", "1");
// Log.d("getPoisHandler", pois.toString());
return pois;
}
// do nothing;
}
Codice:
10-29 17:51:03.571: INFO/System.out(322): Document processing started 10-29 17:51:03.571: INFO/System.out(322): SimpleSaxHandler$SaxHandler.startElement body 10-29 17:51:03.571: INFO/System.out(322): PoiSaxHandler.startElement null 10-29 17:51:03.571: INFO/System.out(322): PoiSaxHandler.startElement type 10-29 17:51:03.571: DEBUG/AndroidRuntime(322): Shutting down VM Sono veramente disperato, sono 3 settimane che ci combatto e che non ne riesco a venire a capo !!! C'è qualche anima pia con esperienza in connessione con WS che mi sà dire dov'è il problema? Guardate se mi date una mano ve ne sarei estremamente riconoscente ma sono disposto anche a pagare se la cosa richiedesse troppo impegno Grazie mille |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Parma
Messaggi: 3010
|
Hai volutamente snellito il codice rimuovendo il contenuto del blocco catch?
Se la risposta è sì, e schianta senza lanciare nessuna eccezione, di solito questo è dovuto all'utilizzo di un jar con dipendenze non completamente soddisfatte. In questo caso direi che potrebbe mancare qualcosa che è necessario a queste classi SAX. (Se qualcuno avesse voglia di spiegare come analizzare meglio situazioni di questo tipo gliene sarei molto grato: le poche volte che mi è successo ho rintracciato le dipendenze mancanti in internet) Se la risposta è no, prova a controllare se viene lanciata qualche eccezione ed, eventualmente, cosa dice (esempio generico): Codice:
[...]
}catch(Exception e){
System.out.print( "Eccezione -> " + e.toString() );
String sMessage = e.getMessage();
if(sMessage != null){
System.out.print( ": " + sMessage );
}
System.out.println();
}
Log.d("MioProgramma", pois.toString());
return pois;
}
__________________
~Breve riferimento ai comandi GNU/Linux (ormai non molto breve...) |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
no in effetti nel blocco catch{} non avevo messo nulla
Attualmente (senza averci messo nulla) il programma si schianta e nel LogCat (semplicemente la zona in Eclipse dove vengono visualizzati i messaggi di errore ed i log di Android, come già detto di fatto sempre di classicissimo Java si tratta) dice questo: Codice:
10-29 22:36:31.038: DEBUG/AndroidRuntime(315): Shutting down VM 10-29 22:36:31.038: WARN/dalvikvm(315): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): FATAL EXCEPTION: main 10-29 22:36:31.098: ERROR/AndroidRuntime(315): java.lang.NullPointerException 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at mieapplicazioni.guidageoreferenziata.GuidaSubActivity.getPois(GuidaSubActivity.java:239) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at mieapplicazioni.guidageoreferenziata.GuidaSubActivity$1.onClick(GuidaSubActivity.java:90) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at android.view.View.performClick(View.java:2408) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at android.view.View$PerformClick.run(View.java:8816) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at android.os.Handler.handleCallback(Handler.java:587) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at android.os.Handler.dispatchMessage(Handler.java:92) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at android.os.Looper.loop(Looper.java:123) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at java.lang.reflect.Method.invokeNative(Native Method) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at java.lang.reflect.Method.invoke(Method.java:521) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 10-29 22:36:31.098: ERROR/AndroidRuntime(315): at dalvik.system.NativeStart.main(Native Method) 10-29 22:36:31.188: WARN/ActivityManager(59): Force finishing activity mieapplicazioni.guidageoreferenziata/.GuidaSubActivity Log.d("MioProgramma", pois.toString()); di fatto credo che mi stia dicendo che dentro la variabile pois che dovrebbe ritornare non ci stà un cippalippa. La riga 90 invece è dove và ad invocare il metodo getPois() nella classe GuidaSubActivity, quindi semplicemente gli stà ritornando ulteriormente indietro l'eccezione... ho provato ad inserire il codice che mi hai detto ma sostanzialmente non cambia nulla, mi dà la stessa cosa e prima mi compare l'output del nuovo printf che dice che è una nullpointerexception: Codice:
10-29 22:45:37.328: INFO/System.out(347): Eccezione -> java.lang.NullPointerException 10-29 22:45:37.328: DEBUG/AndroidRuntime(347): Shutting down VM 10-29 22:45:37.338: WARN/dalvikvm(347): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): FATAL EXCEPTION: main 10-29 22:45:37.359: ERROR/AndroidRuntime(347): java.lang.NullPointerException 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at mieapplicazioni.guidageoreferenziata.GuidaSubActivity.getPois(GuidaSubActivity.java:244) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at mieapplicazioni.guidageoreferenziata.GuidaSubActivity$1.onClick(GuidaSubActivity.java:90) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at android.view.View.performClick(View.java:2408) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at android.view.View$PerformClick.run(View.java:8816) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at android.os.Handler.handleCallback(Handler.java:587) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at android.os.Handler.dispatchMessage(Handler.java:92) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at android.os.Looper.loop(Looper.java:123) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at java.lang.reflect.Method.invokeNative(Native Method) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at java.lang.reflect.Method.invoke(Method.java:521) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 10-29 22:45:37.359: ERROR/AndroidRuntime(347): at dalvik.system.NativeStart.main(Native Method) Grazie |
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Parma
Messaggi: 3010
|
Ok, quindi avevi l'output dell'errore; NullPointerException, sì, direi che il parser si perde subito dopo aver incontrato xsi:type nel secondo getRangePoiReturn.
Però non trovo nulla di palesemente fuori posto. Il codice non l'ho eseguito, ma seguendo questo tutorial direi che dovrebbe produrre qualche output... Stando all'errore mi sembra di capire che cicle viene incrementato una sola volta, è così? Entra negli if di qName.equals("item"), key e value? Non conoscendo la logica di fondo di questo DefaultHandler, il mio unico dubbio è che le variabili p, cicle e currentElement vengano "rovinate"/"desincronizzate" tra le invocazioni automatiche delle varie funzioni.
__________________
~Breve riferimento ai comandi GNU/Linux (ormai non molto breve...) |
|
|
|
|
|
#5 | |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
Quote:
scusa se sono sparito ma in questi 2 giorni ho dovuto lavorare :-/ Intanto grazie dell'ottimo tutorial, purtroppo quel parser non l'ho scritto io (progetto di gruppo) ma mi ci trovo a dover mettere le mani io per risolvere questo casino Il tutorial è stato molto chiaro e mi sono chiarito un bel po di dubbi. Ora la situazione è questa: 1) Nella classe GuidaSubActivity (la classe che effettua la chiamata al web service) nel try{} del metodo getPois() (il metodo che si occupa di effettuare la connessione al WS, di fare la richiesta SOAP e di parsare l'XML) ho messo il seguente codice: Codice:
try{
// Creazione del SAX Parser:
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
Log.d("Crea il parser che punta all'oggetto con indirizzo: ", parser.toString());
// System.out.println(buffer.toString()); // Che è sta robba ?!?! booo pussa viaaa !!!
// Mette in sr il valore contenuto nel buffer sotto forma di stringa
StringReader sr = new StringReader(buffer.toString());
Log.d("E' stato creato uno StringReader sr e passagli il contenuto del buffer in forma di stringa", sr.toString());
// Crea un nuovo oggetto di tipo InputSource e ci mette dentro il valore contenuto in sr
InputSource is = new InputSource(sr);
Log.d("E' stato creato un oggetto InputSource is a cui viene passato il riferimento all'oggetto sr ", is.toString());
PoiSaxHandler handler = new PoiSaxHandler();
Log.d("E' stato creato l'oggetto handler di tipo PoiSaxHandler", handler.toString());
// ATTENZIONEEE NON EFFETTUA IL PARSING !!!
parser.parse(is,handler);
Log.d("Passo al parser l'oggetto is che è:", is.toString());
Log.d("Passo al pareser l'oggetto handler che è: ", handler.toString());
// pois = handler.getPois(); // NB: Variabile dichiarata all'inizio del metodo
bunga = handler.getBunga();
Log.d("La variabile bunga contiene", bunga.toString());
// Log.d("Invoco il metodo getPois sull'oggetto handler", "suka");
// System.out.println("HttpClient.main pois "+pois.toString());
}catch(Exception e){ // Ho inserto questo controllo per vedere che fà
System.out.print( "Eccezione -> " + e.toString() );
String sMessage = e.getMessage();
if(sMessage != null){
System.out.print( ": " + sMessage );
}
System.out.println();
}
// Log.d("MioProgramma", pois.toString());
return pois;
}
Per quanto riguarda la classe dell'handler invece ho seguito il tuturial che mi hai passato ed è diventata la seguente: Codice:
package mieapplicazioni.Http;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
public final class PoiSaxHandler extends DefaultHandler {
private String bunga = "Bunga Bunga";
// Viene invocato quando parte il parsing del documento XML
public void startDocument() throws SAXException {
System.out.println("E' iniziato il parsing del documento XML");
}
// Viene invocato quando termina il parsing del documento XML
public void endDocument() throws SAXException {
System.out.println("Documento XML terminato");
}
// Viene invocato quando sia pre un elemento XML (un tag XML): Stampa il nome del tag che è stato aperto
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
System.out.println("E' stato aperto il tag: " + qName);
}
// Viene invocato quando si chiude un elemento XML (un tag): Stampa il nome del tag che è stato chiuso
public void endElement(String uri, String localName, String qName) throws SAXException {
System.out.println("E' stato chiuso il tag: " + qName);
}
// Viene invocato quando dentro un tag XML trova qualcosa: Stampa come stringa il contenuto di un tax XML non vuoto
public void characters(char ch[], int start, int length) throws SAXException {
System.out.println("Ho trovato il seguente contenuto: " + new String(ch, start, length));
}
public String getBunga(){
return bunga;
}
}
Per quanto riguarda l'output dell'handler mi pare proprio che sia corretto !!! Come sul tutorial l'handler restituisce la lista dei tag XML che si aprono e che si chiudono ed eventualmente il relativo contenuto. Eccoti quà l'output, se riesci a dargli una guardata e dirmi se ti sembra corretto te ne sarei molto grato, a me sembra di si comunque. Vabbè l'output è molto lungo perchè contiene le informazioni rappresentanti vari punti di interesse ed ogni punto di interesse è composto da vari campi informativi Codice:
10-31 19:48:12.142: INFO/System.out(358): E' iniziato il parsing del documento XML 10-31 19:48:12.152: INFO/System.out(358): E' stato aperto il tag: soapenv:Envelope 10-31 19:48:12.152: INFO/System.out(358): E' stato aperto il tag: soapenv:Body 10-31 19:48:12.162: INFO/System.out(358): E' stato aperto il tag: getRangePoiResponse 10-31 19:48:12.162: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:12.173: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:12.173: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.183: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.193: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:12.193: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.193: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.203: INFO/System.out(358): Ho trovato il seguente contenuto: link 2 10-31 19:48:12.203: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.213: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.213: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.213: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.223: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:12.223: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.233: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.233: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.243: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.243: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.253: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.253: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.263: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:12.263: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.273: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.273: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:12.273: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.283: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.293: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.293: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.303: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:12.303: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.303: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.313: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.313: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.313: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.323: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.323: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.323: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:12.333: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.333: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.333: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.333: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.343: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.343: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.343: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.353: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:12.353: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.353: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.363: INFO/System.out(358): Ho trovato il seguente contenuto: 3 10-31 19:48:12.363: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.363: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.373: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.373: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.373: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:12.393: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.393: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.403: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.403: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.403: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.403: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.403: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.403: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:12.413: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.413: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.423: INFO/System.out(358): Ho trovato il seguente contenuto: test 2 10-31 19:48:12.423: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.423: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.433: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:12.433: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:12.433: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.433: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.443: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:12.443: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.453: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.453: INFO/System.out(358): Ho trovato il seguente contenuto: lll 10-31 19:48:12.463: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.463: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.473: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.473: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.473: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:12.473: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.473: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.473: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.473: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.473: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.473: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.473: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.473: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:12.473: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.473: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.473: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:12.483: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.483: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.483: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.493: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.493: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.493: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.493: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.493: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.493: INFO/System.out(358): Ho trovato il seguente contenuto: 13 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.493: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.493: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.493: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.493: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.543: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.543: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.543: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.543: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:12.543: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.543: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.543: INFO/System.out(358): Ho trovato il seguente contenuto: aaab 10-31 19:48:12.543: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.543: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.553: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.553: INFO/System.out(358): Ho trovato il seguente contenuto: lll 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.553: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.553: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.553: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.553: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.553: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.553: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.593: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.593: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:12.593: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.593: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.593: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.593: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.593: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.593: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.603: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.723: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:12.723: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.723: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.723: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.723: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.723: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.723: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.723: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.723: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:12.723: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.723: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.723: INFO/System.out(358): Ho trovato il seguente contenuto: 12 10-31 19:48:12.723: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.723: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.723: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.723: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.723: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:12.723: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.723: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.723: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.723: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.723: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.743: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.743: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.743: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:12.743: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.743: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.743: INFO/System.out(358): Ho trovato il seguente contenuto: jiji 10-31 19:48:12.743: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.743: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.743: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:12.743: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:12.743: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.743: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.743: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:12.743: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.743: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.743: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.763: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.763: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.763: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.763: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:12.763: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.763: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.773: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.773: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.773: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.773: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.773: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.773: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.773: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.773: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.773: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.773: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.773: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.773: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.773: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.773: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.773: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.773: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.773: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.833: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.833: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.833: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:12.833: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.833: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.833: INFO/System.out(358): Ho trovato il seguente contenuto: 11 10-31 19:48:12.833: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.833: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.833: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.833: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.833: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:12.833: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.833: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.833: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.833: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.833: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.863: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.863: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.863: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:12.863: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.863: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.863: INFO/System.out(358): Ho trovato il seguente contenuto: POITest222 10-31 19:48:12.863: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.863: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.863: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:12.863: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:12.863: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.863: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.863: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:12.863: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.873: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.873: INFO/System.out(358): Ho trovato il seguente contenuto: 222 10-31 19:48:12.873: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.873: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.893: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.893: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.893: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:12.893: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.893: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.893: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.893: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.893: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.893: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.893: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.893: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:12.893: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.893: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.893: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:12.893: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.893: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.943: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.943: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.943: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:12.943: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.943: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.943: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.943: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.943: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.943: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.943: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.943: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.953: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.953: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.953: INFO/System.out(358): Ho trovato il seguente contenuto: 10 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.953: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.953: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:12.953: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:12.953: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:12.953: INFO/System.out(358): Ho trovato il seguente contenuto: POITest222 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:12.953: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:13.003: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.013: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:13.013: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.013: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.013: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.013: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:13.013: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.013: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.013: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.013: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.013: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:13.013: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.013: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:13.013: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.013: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.013: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.043: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:13.043: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.043: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.043: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.043: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.043: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.043: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.043: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.043: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:13.043: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.043: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.043: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.043: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.043: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.043: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.064: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.064: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:13.064: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.064: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.064: INFO/System.out(358): Ho trovato il seguente contenuto: 9 10-31 19:48:13.064: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.064: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.064: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.064: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.064: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:13.064: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.064: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.064: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.064: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.064: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.064: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.064: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.064: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:13.064: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.064: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.064: INFO/System.out(358): Ho trovato il seguente contenuto: dfdf 10-31 19:48:13.064: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.103: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.103: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:13.113: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:13.113: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.113: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.113: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:13.113: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.113: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.113: INFO/System.out(358): Ho trovato il seguente contenuto: fdfda 10-31 19:48:13.113: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.113: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.113: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.113: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.113: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:13.113: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.113: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.113: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.113: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.113: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.113: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.113: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.113: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:13.113: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.123: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.174: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:13.174: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.174: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.174: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.174: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.174: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:13.174: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.174: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.174: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.174: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.174: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.174: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.183: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.183: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.183: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.183: INFO/System.out(358): Ho trovato il seguente contenuto: 8 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.183: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.183: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.183: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.183: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.183: INFO/System.out(358): Ho trovato il seguente contenuto: dfd 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.183: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.213: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:13.213: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.213: INFO/System.out(358): Ho trovato il seguente contenuto: dsfdsfsd 10-31 19:48:13.213: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.213: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.213: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:13.213: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.213: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.213: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.213: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.213: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:13.213: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.213: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:13.213: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.213: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.213: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.253: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:13.253: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.253: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.253: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.253: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.253: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.253: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.253: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.253: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:13.253: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.253: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.253: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.253: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.253: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.253: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.253: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.253: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:13.293: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.293: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.293: INFO/System.out(358): Ho trovato il seguente contenuto: 7 10-31 19:48:13.293: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.293: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.293: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.293: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.293: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:13.293: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.293: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.293: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.293: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.293: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.293: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.293: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.313: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:13.313: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.313: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.313: INFO/System.out(358): Ho trovato il seguente contenuto: TEST NAME 10-31 19:48:13.313: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.313: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.313: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:13.313: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:13.313: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.313: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.313: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:13.313: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.313: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.313: INFO/System.out(358): Ho trovato il seguente contenuto: bububb 10-31 19:48:13.313: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.313: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.323: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.323: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.323: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:13.323: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.323: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.323: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.323: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.323: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.323: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.323: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.323: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:13.323: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.323: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.323: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:13.323: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.323: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.323: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.323: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.323: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:13.323: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.323: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.323: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.323: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.323: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.373: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.373: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.373: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:13.373: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.373: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.373: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.373: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.373: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.373: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.373: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.373: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:13.373: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.373: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.373: INFO/System.out(358): Ho trovato il seguente contenuto: 4 10-31 19:48:13.373: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.373: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.373: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.413: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.413: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:13.413: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.413: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.413: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.413: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.413: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.413: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.413: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.413: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:13.413: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.413: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.413: INFO/System.out(358): Ho trovato il seguente contenuto: bubu 10-31 19:48:13.413: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.413: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.413: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:13.413: INFO/System.out(358): E' stato aperto il tag: getRangePoiReturn 10-31 19:48:13.413: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.423: INFO/System.out(358): Ho trovato il seguente contenuto: WikiLink 10-31 19:48:13.423: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.423: INFO/System.out(358): Ho trovato il seguente contenuto: fdfd 10-31 19:48:13.423: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.423: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.423: INFO/System.out(358): Ho trovato il seguente contenuto: Alt 10-31 19:48:13.423: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.423: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.423: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.423: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.423: INFO/System.out(358): Ho trovato il seguente contenuto: Tipologia 10-31 19:48:13.423: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.423: INFO/System.out(358): Ho trovato il seguente contenuto: 0 10-31 19:48:13.423: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.423: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.423: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.473: INFO/System.out(358): Ho trovato il seguente contenuto: Distance 10-31 19:48:13.473: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.473: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.473: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.473: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.473: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.473: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.473: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.503: INFO/System.out(358): Ho trovato il seguente contenuto: Lat 10-31 19:48:13.503: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.503: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.503: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.503: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.503: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.503: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.503: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.503: INFO/System.out(358): Ho trovato il seguente contenuto: Id 10-31 19:48:13.503: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.503: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.503: INFO/System.out(358): Ho trovato il seguente contenuto: 15 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.513: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.513: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.513: INFO/System.out(358): Ho trovato il seguente contenuto: Lon 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.513: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.513: INFO/System.out(358): Ho trovato il seguente contenuto: 0.0 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.513: INFO/System.out(358): E' stato aperto il tag: item 10-31 19:48:13.513: INFO/System.out(358): E' stato aperto il tag: key 10-31 19:48:13.513: INFO/System.out(358): Ho trovato il seguente contenuto: Nome 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: key 10-31 19:48:13.513: INFO/System.out(358): E' stato aperto il tag: value 10-31 19:48:13.513: INFO/System.out(358): Ho trovato il seguente contenuto: fdf 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: value 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: item 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: getRangePoiReturn 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: getRangePoiResponse 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: soapenv:Body 10-31 19:48:13.513: INFO/System.out(358): E' stato chiuso il tag: soapenv:Envelope 10-31 19:48:13.513: INFO/System.out(358): Documento XML terminato 10-31 19:48:13.513: DEBUG/Passo al parser l'oggetto is che è:(358): org.xml.sax.InputSource@43f12940 10-31 19:48:13.993: DEBUG/dalvikvm(358): GC_FOR_MALLOC freed 4807 objects / 402288 bytes in 469ms 10-31 19:48:13.993: DEBUG/Passo al pareser l'oggetto handler che è:(358): mieapplicazioni.Http.PoiSaxHandler@43f359f8 10-31 19:48:13.993: DEBUG/La variabile bunga contiene(358): Bunga Bunga 10-31 19:48:14.823: INFO/MapActivity(358): Handling network change notification:CONNECTED Poi accade una cosa un po' strana (che credo dipenda da come è stato progettato il WS...non da me), apre un tag generale <getRangePoiReturn> ed in seguito apre un altro tag chiamato sempre <getRangePoiReturn> che però identifica ogni elemento POI ritornato dal WS. Ad esempio subito dopo si apre il tag: Codice:
<getRangePoiReturn xsi:type="ns1:Map" xmlns:ns1="http://xml.apache.org/xml-soap"> Successivamente si aprirà il tag: Codice:
<getRangePoiReturn xsi:type="ns2:Map" xmlns:ns1="http://xml.apache.org/xml-soap"> Francamente non sò se sia stata una furbata il fatto che ci sia un tag generale chiamato <getRangePoiReturn> e che al suo interno ci siano altri tag con lo stesso nome che però identificano i punti di interesse...però questo ho e questo devo usare... Ti faccio vedere brevemente un pezzo di tale file XML facendo la richiesta con soapUI (di fatto è lo stesso file che viene gestito dall'handler): Codice:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getRangePoiResponse xmlns="http://example">
<getRangePoiReturn>
<getRangePoiReturn xsi:type="ns1:Map" xmlns:ns1="http://xml.apache.org/xml-soap">
<item xmlns="">
<key xsi:type="xsd:string">WikiLink</key>
<value xsi:type="xsd:string">link 2</value>
</item>
<item xmlns="">
<key xsi:type="xsd:string">Alt</key>
<value xsi:type="xsd:float">0.0</value>
</item>
<item xmlns="">
<key xsi:type="xsd:string">Tipologia</key>
<value xsi:type="xsd:int">0</value>
</item>
<item xmlns="">
<key xsi:type="xsd:string">Distance</key>
<value xsi:type="xsd:double">0.0</value>
</item>
<item xmlns="">
<key xsi:type="xsd:string">Lat</key>
<value xsi:type="xsd:float">0.0</value>
</item>
<item xmlns="">
<key xsi:type="xsd:string">Id</key>
<value xsi:type="xsd:int">3</value>
</item>
<item xmlns="">
<key xsi:type="xsd:string">Lon</key>
<value xsi:type="xsd:float">0.0</value>
</item>
<item xmlns="">
<key xsi:type="xsd:string">Nome</key>
<value xsi:type="xsd:string">test 2</value>
</item>
</getRangePoiReturn>
.....
.....
etcetc
.....
.....
In pratica credo che il mio parser dovrebbe fare la seguente cosa: 1) Iniziare a parsare il documento ed ignorare l'apertura dei tag: Evelope, Body, getRangePoiRespons ed il primo tag generale <getRangePoiReturn> 2) Quando trova un tag di tipo: Codice:
<getRangePoiReturn xsi:type="ns1:Map" xmlns:ns1="http://xml.apache.org/xml-soap"> 3) Andando avanti con il parsing quando trova all'interno un tag di tipo item significa che quella è un campo dell'oggetto Poi creato e che bisogna settare tale valore nell'oggetto di tipo Poi in questione. Ad esempio, questo codice: Codice:
<item xmlns="">
<key xsi:type="xsd:string">WikiLink</key>
<value xsi:type="xsd:string">link 2</value>
</item>
3) Quando poi si chiude il tag: </getRangePoiReturn> più esterno deve accodare ad una l'ista di Poi l'oggetto Poi creato e a cui sono state settati tutti i campi Solo che mi pare una cosa allucinante e cervellotica !!! Però temo che con il WS fatto così (e che non posso cambiare) sai l'unica possibilità e credo che la classe handler che avevo pubblicato inizialmente dovrebbe fare proprio quello... Per favore mi sai aiutare in qualche modo? (già confermae o smentire le mie ipotesi sarebbe una gran cosa) Grazie |
|
|
|
|
|
|
#6 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Parma
Messaggi: 3010
|
Confermo tutto quanto hai scritto.
Anche a me sembrava piuttosto strano l'utilizzo di tag dal nome sostanzialmente uguale per due livelli adiacenti, però il secondo livello ha attributi che lo rendono univoco, in particolare il type, quindi è utilizzabile. Come hai visto quel codice srotola correttamente l'XML, ed il tuo codice originale sembra essere logicamente corretto. Il modo per capire cosa va storto durante il parse è provare ad attivare i System.out del parser, che sono nei punti chiave. Ho appena notato una imprecisione: Codice:
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Wikilink")))
isWiki=true;
Codice:
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("WikiLink")))
isWiki=true;
__________________
~Breve riferimento ai comandi GNU/Linux (ormai non molto breve...) |
|
|
|
|
|
#7 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
Ciao,
ho provato a fare come mi hai detto andando ad inserire dei System.out nell'handler ed andando a correggere quell'imprecisione di cui parlavi, ho degli output ma il file XML ancora non viene parsato correttamente a quanto pare. Attualmente il mio file handler corretto e con i System.out che ho inserito (forse ne devo inserire anche altri da altre parti per capire bene? sapresti indicarmi dove eventualmente?) è questo: Codice:
package mieapplicazioni.Http;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
public final class PoiSaxHandler extends DefaultHandler {
private boolean isId;
private boolean isLat;
private boolean isLon;
private boolean isAlt;
private boolean isTipologia;
private boolean isWiki;
private boolean isPoiId;
private boolean isNome;
private int cicle=0;
// Viene invocato quando inizia il parsing del documento XML:
public void startDocument() throws SAXException {
System.out.println("E' iniziato il parsing del documento XML");
}
private Poi p = null; // Dichiaro il riferimento ad un oggetto Poi che inizialmente punta a null
private List<Poi> pois = new ArrayList<Poi>(); // Crea un'array list di oggetti di tipo Poi
private String currentElement = null; // currentElement è una stringa inizialmente nulla
// notifies about finish of parsing: !?!?! DUBBIO: Così aggiunge un solo oggetto Poi alla lista: l'ultimo
public void endDocument() throws SAXException {
pois.add(p); // Aggiunge l'oggetto Poi p alla lista di Poi
System.out.println("Document processing finished"); // Stampa il messaggio che dice che il parsing è terminato
}
// we enter to element 'qName': Viene invocato quando trova un nuovo elemento, il nome dell'elemento è in qName
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
String key=""; // la stringa key è inizialmente vuota
if (qName.equals("soapenv:Envelope")) { // Se è il tag <soapenv:Envelope ....>
currentElement=qName; // Mette "soapenv:Envelope" dentro la variabile currentElement
}
else if (qName.equals("soapenv:Body")) { // Se è il tag <soapenv:Body>
currentElement=qName; // mette "soapenv:Body" dentro la variabile currentElement
//System.out.println("SimpleSaxHandler$SaxHandler.startElement body");
System.out.println("E' stato aperto il tag: " + qName);
}
else if (qName.equals("listPoiReturn")) { // Se è il tag "listPoiReturn" NON C'È NEL MIO XML
currentElement=qName; // Mette dentro current element listPoiReturn
//System.out.println("SimpleSaxHandler$SaxHandler.startElement listPois");
}
else if(qName.equals("getRangePoiResponse")) { // Se è il tag <getRangePoiResponse....>
currentElement=qName; // Mette getRangePoiResponse dentro currentElement
System.out.println("E' stato aperto il tag: " + qName);
}
else if(qName.equals("getRangePoiReturn")) { // Se + il tag <getRangePoiReturn...>
currentElement=qName; // Mette getRangePoiReturn dentro currentElement
System.out.println("E' stato aperto getRangePoiReturn");
System.out.println("PoiSaxHandler.startElement "+attrs.getLocalName(0));
if(attrs.getLocalName(0)!=null&&attrs.getLocalName(0).equals("xsi:type"))
{
//System.out.println("SimpleSaxHandler$SaxHandler.startElement nuovo pois");
if(cicle==0){
p=new Poi();
System.out.println("La variabile cicle vale: " + cicle);
}
else{
System.out.println("La variabile cicle vale: " + cicle);
pois.add(p);
p=new Poi();
}
cicle++;
System.out.println("La variabile cicle vale: " + cicle);
}
}
else if (qName.equals("item")){
currentElement=qName;
System.out.println("E' stato aperto il tag: " + qName); // E' entrato nel tag item
}
else if (qName.equals("key")){
currentElement=qName;
System.out.println("E' stato aperto il tag: " + qName); // E' entrato nel tag key
//System.out.println("SimpleSaxHandler$SaxHandler "+currentElement);
//System.out.println("SimpleSaxHandler$SaxHandler.startElement key "+key);
}
else if (qName.equals("value")){
currentElement=qName;
System.out.println("E' stato aperto il tag: " + qName); // E' entrato nel dag value
//System.out.println("SimpleSaxHandler$SaxHandler.startElement value di "+key+" -->"+attrs.getQName(0));
}
else {
throw new IllegalArgumentException("Element '" +
qName + "' is not allowed here");
}
}
// we leave element 'qName' without any actions:
public void endElement(String uri, String localName, String qName)
throws SAXException {
//System.out.println("SimpleSaxHandler$SaxHandler.endElement "+qName);
}
public void characters(char ch[], int start, int length)
throws SAXException {
if(currentElement.equals("key")&&(new String(ch, start, length).equals("Id")))
isId=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Lat")))
isLat=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Lon")))
isLon=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Alt")))
isAlt=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Tipologia")))
isTipologia=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Nome")))
isNome=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("WikiLink"))) // ho cambiato Wikilink con WikiLink
isWiki=true;
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Distance")))
isPoiId=true;
//System.out.println("currentElement: "+currentElement+" -->"+ new String(ch, start, length));
if (isId&¤tElement.equals("value")) {
p.setId(Long.parseLong(new String(ch, start, length)));
System.out.println("id: "
+ new String(ch, start, length));
isId=false;
}else if (isLat&¤tElement.equals("value")) {
p.setLat(Float.parseFloat(new String(ch, start, length)));
System.out.println("lat: "
+ new String(ch, start, length));
isLat=false;
}else if (isLon&¤tElement.equals("value")) {
p.setLon(Float.parseFloat(new String(ch, start, length)));
System.out.println("lon: "
+ new String(ch, start, length));
isLon=false;
}
else if(currentElement.equals("value")&&(isAlt))
{
p.setAlt(Float.parseFloat(new String(ch, start, length)));
System.out.println("alt: "
+ new String(ch, start, length));
isAlt=false;;
}
else if(currentElement.equals("value")&&(isTipologia))
{
String sTipologia=new String(ch, start, length);
int tipologia=0;
if(sTipologia!=null&&!sTipologia.equals(""))
tipologia=Integer.parseInt(sTipologia);
p.setTipologia(tipologia);
System.out.println("Tipologia: "
+ new String(ch, start, length));
isTipologia=false;
}
else if(currentElement.equals("value")&&(isNome))
{
p.setNome(new String(ch, start, length));
System.out.println("Nome: "
+ new String(ch, start, length));
isNome=false;
}
else if(currentElement.equals("value")&&(isWiki))
{
p.setWikilynk(new String(ch, start, length));
System.out.println("Wiki: "
+ new String(ch, start, length));
isWiki=false;
}
else if(currentElement.equals("value")&&(isPoiId))
{
String sPoiId=new String(ch, start, length);
Long poiId=0L;
//if(sPoiId!=null&&!sPoiId.trim().equals(""))
//poiId=Long.parseLong(sPoiId);
p.setPoiId(sPoiId);
System.out.println("PoiId: "
+ new String(ch, start, length));
isPoiId=false;
}
}
public List<Poi> getPois() {
//Log.d("Sono entranto nel metodo getPois dentro la classe PoiSaxHandler", "1");
// Log.d("getPoisHandler", pois.toString());
return pois;
}
// do nothing;
}
Codice:
11-01 09:54:54.793: INFO/System.out(317): E' iniziato il parsing del documento XML 11-01 09:54:54.802: INFO/System.out(317): E' stato aperto il tag: soapenv:Body 11-01 09:54:54.802: INFO/System.out(317): E' stato aperto il tag: getRangePoiResponse 11-01 09:54:54.813: INFO/System.out(317): E' stato aperto getRangePoiReturn 11-01 09:54:54.823: INFO/System.out(317): PoiSaxHandler.startElement null 11-01 09:54:54.823: INFO/System.out(317): E' stato aperto getRangePoiReturn 11-01 09:54:54.832: INFO/System.out(317): PoiSaxHandler.startElement type 11-01 09:54:54.842: INFO/System.out(317): E' stato aperto il tag: item 11-01 09:54:54.842: INFO/System.out(317): E' stato aperto il tag: key 11-01 09:54:54.863: INFO/System.out(317): E' stato aperto il tag: value 11-01 09:54:54.943: INFO/System.out(317): Eccezione -> java.lang.NullPointerException 11-01 09:54:55.523: INFO/MapActivity(317): Handling network change notification:CONNECTED Poi pare che entri dentro il tag <getRangePoiReturn xsi:type="ns1:Map...> (quello più interno che rappresenta un punto di interesse). A questo punto inizia ad entrare nei vari tag item che descrivono un campo del punto di interesse e pare entrare anche nei tag interni da item key e value che a loro volta descrivono il nome del campo ed il valore di tale campo (non sò prchè ma non mi riesce a stampare il valore della variabile cicle...che onestamente non ho chiarissimo a cosa serve) Poi però sembra bloccarsi? Hai qualche idea del perchè o comunque su come procedere a vedere dov'è che si và ad inchiodare? Per favore...se riesci ad aiutarmi te ne sarei veramente grato...sono proprio tanto tanto tanto nei casini... Grazie mille |
|
|
|
|
|
#8 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Parma
Messaggi: 3010
|
Attiva il System.out dopo gli if else all'inizio della funzione characters, altrimenti non si capisce al 100% che succede; non è che le stringhe create per i confronti contengono un carattere in più?
Sembra non entri in nessuno degli if che impostano i booleani che rappresentano il raggiungimento dei vari valori. Non mi convince molto l'uso esagerato di new String(ch, start, length), sarebbe preferibile creare l'oggetto stringa all'inizio della funzione e poi sfruttarlo in tutti i confronti e dove serve in seguito.
__________________
~Breve riferimento ai comandi GNU/Linux (ormai non molto breve...) |
|
|
|
|
|
#9 | |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
Quote:
Grazie mille del tuo aiuto comunque |
|
|
|
|
|
|
#10 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Parma
Messaggi: 3010
|
Intendo questo:
Codice:
public void characters(char ch[], int start, int length)
throws SAXException {
[...]
else if(currentElement.equals("key")&&(new String(ch, start, length).equals("Distance")))
isPoiId=true;
System.out.println("currentElement: "+currentElement+" -->"+ new String(ch, start, length));
if (isId&¤tElement.equals("value")) {
[...]
__________________
~Breve riferimento ai comandi GNU/Linux (ormai non molto breve...) |
|
|
|
|
|
#11 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
ah ok, quindi dovevo solo attivare quel System.out che era stato commentato...allora...il risultato dato in output ora è il seguente:
Codice:
11-01 15:52:09.816: INFO/System.out(312): E' iniziato il parsing del documento XML 11-01 15:52:09.836: INFO/System.out(312): E' stato aperto il tag: soapenv:Body 11-01 15:52:09.836: INFO/System.out(312): E' stato aperto il tag: getRangePoiResponse 11-01 15:52:09.846: INFO/System.out(312): E' stato aperto getRangePoiReturn 11-01 15:52:09.846: INFO/System.out(312): PoiSaxHandler.startElement null 11-01 15:52:09.856: INFO/System.out(312): E' stato aperto getRangePoiReturn 11-01 15:52:09.856: INFO/System.out(312): PoiSaxHandler.startElement type 11-01 15:52:09.866: INFO/System.out(312): E' stato aperto il tag: item 11-01 15:52:09.866: INFO/System.out(312): E' stato aperto il tag: key 11-01 15:52:09.876: INFO/System.out(312): currentElement: key -->WikiLink 11-01 15:52:09.886: INFO/System.out(312): E' stato aperto il tag: value 11-01 15:52:09.886: INFO/System.out(312): currentElement: value -->link 2 11-01 15:52:09.906: INFO/System.out(312): Eccezione -> java.lang.NullPointerException 11-01 15:52:10.566: INFO/MapActivity(312): Handling network change notification:CONNECTED Poi si inchioda e non riesco proprio a capire perchè Te per caso riesci ad avere qualche idea su come sistemare sto coso? Grazie mille |
|
|
|
|
|
#12 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
Ho cambiato il metodo originale characted() con il seguente ma continua a non andare
Codice:
public void characters(char ch[], int start, int length) throws SAXException{
System.out.println("Sono entrato nel metodo character()");
String sText = new String(ch, start, length).trim();
if(sText == null){
sText = "";
}
if(currentElement == null){
currentElement = "";
}
if(currentElement.equals("key")){
if(sText.equals("Id")){
System.out.println("Id: "+currentElement+" --> "+ sText);
isId = true;
}else if(sText.equals("Lat")){
System.out.println("Lat: "+currentElement+" --> "+ sText);
isLat = true;
}else if(sText.equals("Lon")){
System.out.println("Lon: "+currentElement+" --> "+ sText);
isLon = true;
}else if(sText.equals("Alt")){
System.out.println("Alt: "+currentElement+" --> "+ sText);
isAlt = true;
}else if(sText.equals("Tipologia")){
System.out.println("Tipologia: "+currentElement+" --> "+ sText);
isTipologia = true;
}else if(sText.equals("Nome")){
System.out.println("Nome: "+currentElement+" --> "+ sText);
isNome = true;
}else if(sText.equals("WikiLink")){ // ho cambiato Wikilink con WikiLink
System.out.println("WikiLink: "+currentElement+" --> "+ sText);
isWiki = true;
}else if(sText.equals("Distance")){
System.out.println("Distance: "+currentElement+" --> "+ sText);
isPoiId = true;
}
}else if(currentElement.equals("value")){
if(isId){
isId = false;
long id = 0;
if(sText.length() > 0)
id = Long.parseLong(sText);
p.setId(id);
System.out.println("id: "+id);
}else if(isLat){
isLat = false;
float lat = 0;
if(sText.length() > 0){
lat = Float.parseFloat(sText);
}
p.setLat(lat);
System.out.println("lat: "+lat);
}else if(isLon){
isLon = false;
float lon = 0;
if(sText.length() > 0){
lon = Float.parseFloat(sText);
}
p.setLon(lon);
System.out.println("lon: "+lon);
}else if(isAlt){
isAlt = false;
float alt = 0;
if(sText.length() > 0){
alt = Float.parseFloat(sText);
}
p.setAlt(alt);
System.out.println("alt: "+alt);
}else if(isTipologia){
isTipologia = false;
int tipologia = 0;
if(sText.length() > 0){
tipologia = Integer.parseInt(sText);
}
p.setTipologia(tipologia);
System.out.println("Tipologia: "+tipologia);
}else if(isNome){
isNome = false;
p.setNome(sText);
System.out.println("Nome: "+sText);
}else if(isWiki){
isWiki = false;
p.setWikilynk(sText);
System.out.println("Wiki: "+sText);
}else if(isPoiId){
isPoiId = false;
Long poiId = null;
if(sText.length() > 0){
poiId=Long.parseLong(sText);
}
p.setPoiId(poiId.toString());
System.out.println("PoiId: "+poiId);
}
}
}
Codice:
11-01 17:35:07.321: INFO/System.out(375): E' iniziato il parsing del documento XML 11-01 17:35:07.331: INFO/System.out(375): E' stato aperto il tag: soapenv:Body 11-01 17:35:07.331: INFO/System.out(375): E' stato aperto il tag: getRangePoiResponse 11-01 17:35:07.341: INFO/System.out(375): E' stato aperto getRangePoiReturn 11-01 17:35:07.341: INFO/System.out(375): PoiSaxHandler.startElement null 11-01 17:35:07.351: INFO/System.out(375): E' stato aperto getRangePoiReturn 11-01 17:35:07.361: INFO/System.out(375): PoiSaxHandler.startElement type 11-01 17:35:07.361: INFO/System.out(375): E' stato aperto il tag: item 11-01 17:35:07.371: INFO/System.out(375): E' stato aperto il tag: key 11-01 17:35:07.371: INFO/System.out(375): Sono entrato nel metodo character() 11-01 17:35:07.381: INFO/System.out(375): WikiLink: key --> WikiLink 11-01 17:35:07.381: INFO/System.out(375): E' stato aperto il tag: value 11-01 17:35:07.391: INFO/System.out(375): Sono entrato nel metodo character() 11-01 17:35:07.411: INFO/System.out(375): Eccezione -> java.lang.NullPointerException 11-01 17:35:07.991: INFO/MapActivity(375): Handling network change notification:CONNECTED Tnx |
|
|
|
|
|
#13 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Parma
Messaggi: 3010
|
Potrebbe essere colpa di length?
Codice:
public void characters(char ch[], int start, int length) throws SAXException{
System.out.println("character(): "+start+" -> "+length);
String sText = "";
if(length > 0){
sText = new String(ch, start, length).trim();
}
if(currentElement == null){
currentElement = "";
}
[...]
__________________
~Breve riferimento ai comandi GNU/Linux (ormai non molto breve...) |
|
|
|
|
|
#14 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
mmm mi stai dicendo che dovrei provare a sostituire così?:
Codice:
public void characters(char ch[], int start, int length) throws SAXException{
System.out.println("Sono entrato nel metodo character()");
String sText = new String(ch, start, length).trim();
if(sText == null){
sText = "";
}
if(currentElement == null){
currentElement = "";
}
Codice:
public void characters(char ch[], int start, int length) throws SAXException{
System.out.println("Sono entrato nel metodo character()");
String sText = new String(ch, start, length).trim();
if(length > 0){
sText = new String(ch, start, length).trim();
}
if(currentElement == null){
currentElement = "";
}
Codice:
11-01 18:48:02.750: INFO/System.out(319): E' iniziato il parsing del documento XML 11-01 18:48:02.770: INFO/System.out(319): E' stato aperto il tag: soapenv:Body 11-01 18:48:02.780: INFO/System.out(319): E' stato aperto il tag: getRangePoiResponse 11-01 18:48:02.780: INFO/System.out(319): E' stato aperto getRangePoiReturn 11-01 18:48:02.790: INFO/System.out(319): PoiSaxHandler.startElement null 11-01 18:48:02.790: INFO/System.out(319): E' stato aperto getRangePoiReturn 11-01 18:48:02.800: INFO/System.out(319): PoiSaxHandler.startElement type 11-01 18:48:02.800: INFO/System.out(319): E' stato aperto il tag: item 11-01 18:48:02.810: INFO/System.out(319): E' stato aperto il tag: key 11-01 18:48:02.810: INFO/System.out(319): Sono entrato nel metodo character() 11-01 18:48:02.820: INFO/System.out(319): WikiLink: key --> WikiLink 11-01 18:48:02.820: INFO/System.out(319): E' stato aperto il tag: value 11-01 18:48:02.830: INFO/System.out(319): Sono entrato nel metodo character() 11-01 18:48:02.840: INFO/System.out(319): Eccezione -> java.lang.NullPointerException 11-01 18:48:03.510: INFO/MapActivity(319): Handling network change notification:CONNECTED Per completezza ti riporto tutta la mia classe dell'handler così come è attualmente: Codice:
package mieapplicazioni.Http;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
public final class PoiSaxHandler extends DefaultHandler {
private boolean isId;
private boolean isLat;
private boolean isLon;
private boolean isAlt;
private boolean isTipologia;
private boolean isWiki;
private boolean isPoiId;
private boolean isNome;
private int cicle=0;
// Viene invocato quando inizia il parsing del documento XML:
public void startDocument() throws SAXException {
System.out.println("E' iniziato il parsing del documento XML");
}
private Poi p = null; // Dichiaro il riferimento ad un oggetto Poi che inizialmente punta a null
private List<Poi> pois = new ArrayList<Poi>(); // Crea un'array list di oggetti di tipo Poi
private String currentElement = null; // currentElement è una stringa inizialmente nulla
// notifies about finish of parsing: !?!?! DUBBIO: Così aggiunge un solo oggetto Poi alla lista: l'ultimo
public void endDocument() throws SAXException {
pois.add(p); // Aggiunge l'oggetto Poi p alla lista di Poi
System.out.println("Document processing finished"); // Stampa il messaggio che dice che il parsing è terminato
}
// we enter to element 'qName': Viene invocato quando trova un nuovo elemento, il nome dell'elemento è in qName
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
String key=""; // la stringa key è inizialmente vuota
if (qName.equals("soapenv:Envelope")) { // Se è il tag <soapenv:Envelope ....>
currentElement=qName; // Mette "soapenv:Envelope" dentro la variabile currentElement
}
else if (qName.equals("soapenv:Body")) { // Se è il tag <soapenv:Body>
currentElement=qName; // mette "soapenv:Body" dentro la variabile currentElement
//System.out.println("SimpleSaxHandler$SaxHandler.startElement body");
System.out.println("E' stato aperto il tag: " + qName);
}
else if (qName.equals("listPoiReturn")) { // Se è il tag "listPoiReturn" NON C'È NEL MIO XML
currentElement=qName; // Mette dentro current element listPoiReturn
//System.out.println("SimpleSaxHandler$SaxHandler.startElement listPois");
}
else if(qName.equals("getRangePoiResponse")) { // Se è il tag <getRangePoiResponse....>
currentElement=qName; // Mette getRangePoiResponse dentro currentElement
System.out.println("E' stato aperto il tag: " + qName);
}
else if(qName.equals("getRangePoiReturn")) { // Se + il tag <getRangePoiReturn...>
currentElement=qName; // Mette getRangePoiReturn dentro currentElement
System.out.println("E' stato aperto getRangePoiReturn");
System.out.println("PoiSaxHandler.startElement "+attrs.getLocalName(0));
if(attrs.getLocalName(0)!=null&&attrs.getLocalName(0).equals("xsi:type"))
{
//System.out.println("SimpleSaxHandler$SaxHandler.startElement nuovo pois");
if(cicle==0){
p=new Poi();
System.out.println("La variabile cicle vale: " + cicle);
}
else{
System.out.println("La variabile cicle vale: " + cicle);
pois.add(p);
p=new Poi();
}
cicle++;
System.out.println("La variabile cicle vale: " + cicle);
}
}
else if (qName.equals("item")){
currentElement=qName;
System.out.println("E' stato aperto il tag: " + qName); // E' entrato nel tag item
}
else if (qName.equals("key")){
currentElement=qName;
System.out.println("E' stato aperto il tag: " + qName); // E' entrato nel tag key
//System.out.println("SimpleSaxHandler$SaxHandler "+currentElement);
//System.out.println("SimpleSaxHandler$SaxHandler.startElement key "+key);
}
else if (qName.equals("value")){
currentElement=qName;
System.out.println("E' stato aperto il tag: " + qName); // E' entrato nel dag value
//System.out.println("SimpleSaxHandler$SaxHandler.startElement value di "+key+" -->"+attrs.getQName(0));
}
else {
throw new IllegalArgumentException("Element '" +
qName + "' is not allowed here");
}
}
// we leave element 'qName' without any actions:
public void endElement(String uri, String localName, String qName)
throws SAXException {
//System.out.println("SimpleSaxHandler$SaxHandler.endElement "+qName);
}
public void characters(char ch[], int start, int length) throws SAXException{
System.out.println("Sono entrato nel metodo character()");
String sText = new String(ch, start, length).trim();
if(length > 0){
sText = new String(ch, start, length).trim();
}
if(currentElement == null){
currentElement = "";
}
if(currentElement.equals("key")){
if(sText.equals("Id")){
System.out.println("Id: "+currentElement+" --> "+ sText);
isId = true;
}else if(sText.equals("Lat")){
System.out.println("Lat: "+currentElement+" --> "+ sText);
isLat = true;
}else if(sText.equals("Lon")){
System.out.println("Lon: "+currentElement+" --> "+ sText);
isLon = true;
}else if(sText.equals("Alt")){
System.out.println("Alt: "+currentElement+" --> "+ sText);
isAlt = true;
}else if(sText.equals("Tipologia")){
System.out.println("Tipologia: "+currentElement+" --> "+ sText);
isTipologia = true;
}else if(sText.equals("Nome")){
System.out.println("Nome: "+currentElement+" --> "+ sText);
isNome = true;
}else if(sText.equals("WikiLink")){ // ho cambiato Wikilink con WikiLink
System.out.println("WikiLink: "+currentElement+" --> "+ sText);
isWiki = true;
}else if(sText.equals("Distance")){
System.out.println("Distance: "+currentElement+" --> "+ sText);
isPoiId = true;
}
}else if(currentElement.equals("value")){
if(isId){
isId = false;
long id = 0;
if(sText.length() > 0)
id = Long.parseLong(sText);
p.setId(id);
System.out.println("id: "+id);
}else if(isLat){
isLat = false;
float lat = 0;
if(sText.length() > 0){
lat = Float.parseFloat(sText);
}
p.setLat(lat);
System.out.println("lat: "+lat);
}else if(isLon){
isLon = false;
float lon = 0;
if(sText.length() > 0){
lon = Float.parseFloat(sText);
}
p.setLon(lon);
System.out.println("lon: "+lon);
}else if(isAlt){
isAlt = false;
float alt = 0;
if(sText.length() > 0){
alt = Float.parseFloat(sText);
}
p.setAlt(alt);
System.out.println("alt: "+alt);
}else if(isTipologia){
isTipologia = false;
int tipologia = 0;
if(sText.length() > 0){
tipologia = Integer.parseInt(sText);
}
p.setTipologia(tipologia);
System.out.println("Tipologia: "+tipologia);
}else if(isNome){
isNome = false;
p.setNome(sText);
System.out.println("Nome: "+sText);
}else if(isWiki){
isWiki = false;
p.setWikilynk(sText);
System.out.println("Wiki: "+sText);
}else if(isPoiId){
isPoiId = false;
Long poiId = null;
if(sText.length() > 0){
poiId=Long.parseLong(sText);
}
p.setPoiId(poiId.toString());
System.out.println("PoiId: "+poiId);
}
}
}
public List<Poi> getPois() {
//Log.d("Sono entranto nel metodo getPois dentro la classe PoiSaxHandler", "1");
// Log.d("getPoisHandler", pois.toString());
return pois;
}
// do nothing;
}
|
|
|
|
|
|
#15 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Parma
Messaggi: 3010
|
No, cambia tutto il blocco, soprattutto le righe precedenti all'if (e pure il System.out); ho evidenziato il test perché il mio principale sospettato è length.
__________________
~Breve riferimento ai comandi GNU/Linux (ormai non molto breve...) |
|
|
|
|
|
#16 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
Ok...ho cambiato come mi hai detto (spero), così:
Codice:
public void characters(char ch[], int start, int length) throws SAXException{
System.out.println("character(): "+start+" -> "+length);
String sText = "";
if(length > 0){
sText = new String(ch, start, length).trim();
}
if(currentElement == null){
currentElement = "";
}
if(currentElement.equals("key")){
if(sText.equals("Id")){
System.out.println("Id: "+currentElement+" --> "+ sText);
isId = true;
}else if(sText.equals("Lat")){
System.out.println("Lat: "+currentElement+" --> "+ sText);
isLat = true;
}else if(sText.equals("Lon")){
System.out.println("Lon: "+currentElement+" --> "+ sText);
isLon = true;
}else if(sText.equals("Alt")){
System.out.println("Alt: "+currentElement+" --> "+ sText);
isAlt = true;
}else if(sText.equals("Tipologia")){
System.out.println("Tipologia: "+currentElement+" --> "+ sText);
isTipologia = true;
}else if(sText.equals("Nome")){
System.out.println("Nome: "+currentElement+" --> "+ sText);
isNome = true;
}else if(sText.equals("WikiLink")){ // ho cambiato Wikilink con WikiLink
System.out.println("WikiLink: "+currentElement+" --> "+ sText);
isWiki = true;
}else if(sText.equals("Distance")){
System.out.println("Distance: "+currentElement+" --> "+ sText);
isPoiId = true;
}
}else if(currentElement.equals("value")){
if(isId){
isId = false;
long id = 0;
if(sText.length() > 0)
id = Long.parseLong(sText);
p.setId(id);
System.out.println("id: "+id);
}else if(isLat){
isLat = false;
float lat = 0;
if(sText.length() > 0){
lat = Float.parseFloat(sText);
}
p.setLat(lat);
System.out.println("lat: "+lat);
}else if(isLon){
isLon = false;
float lon = 0;
if(sText.length() > 0){
lon = Float.parseFloat(sText);
}
p.setLon(lon);
System.out.println("lon: "+lon);
}else if(isAlt){
isAlt = false;
float alt = 0;
if(sText.length() > 0){
alt = Float.parseFloat(sText);
}
p.setAlt(alt);
System.out.println("alt: "+alt);
}else if(isTipologia){
isTipologia = false;
int tipologia = 0;
if(sText.length() > 0){
tipologia = Integer.parseInt(sText);
}
p.setTipologia(tipologia);
System.out.println("Tipologia: "+tipologia);
}else if(isNome){
isNome = false;
p.setNome(sText);
System.out.println("Nome: "+sText);
}else if(isWiki){
isWiki = false;
p.setWikilynk(sText);
System.out.println("Wiki: "+sText);
}else if(isPoiId){
isPoiId = false;
Long poiId = null;
if(sText.length() > 0){
poiId=Long.parseLong(sText);
}
p.setPoiId(poiId.toString());
System.out.println("PoiId: "+poiId);
}
}
}
Codice:
11-01 19:27:06.665: INFO/System.out(314): E' iniziato il parsing del documento XML 11-01 19:27:06.685: INFO/System.out(314): E' stato aperto il tag: soapenv:Body 11-01 19:27:06.685: INFO/System.out(314): E' stato aperto il tag: getRangePoiResponse 11-01 19:27:06.685: INFO/System.out(314): E' stato aperto getRangePoiReturn 11-01 19:27:06.705: INFO/System.out(314): PoiSaxHandler.startElement null 11-01 19:27:06.705: INFO/System.out(314): E' stato aperto getRangePoiReturn 11-01 19:27:06.705: INFO/System.out(314): PoiSaxHandler.startElement type 11-01 19:27:06.715: INFO/System.out(314): E' stato aperto il tag: item 11-01 19:27:06.725: INFO/System.out(314): E' stato aperto il tag: key 11-01 19:27:06.725: INFO/System.out(314): character(): 0 -> 8 11-01 19:27:06.735: INFO/System.out(314): WikiLink: key --> WikiLink 11-01 19:27:06.735: INFO/System.out(314): E' stato aperto il tag: value 11-01 19:27:06.745: INFO/System.out(314): character(): 0 -> 6 11-01 19:27:06.755: INFO/System.out(314): Eccezione -> java.lang.NullPointerException |
|
|
|
|
|
#17 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Parma
Messaggi: 3010
|
Ormai non riesco più a vedere punti che possano scatenare NullPointer.
I miei sospetti cadono su p.setWikilynk(sText), concentra in quel punto la raccolta di informazioni: Codice:
[...]
}else if(currentElement.equals("value")){
System.out.println("value: "+sText);
if(isId){
isId = false;
long id = 0;
if(sText.length() > 0)
id = Long.parseLong(sText);
p.setId(id);
System.out.println("id: "+id);
}else if(isLat){
isLat = false;
float lat = 0;
if(sText.length() > 0){
lat = Float.parseFloat(sText);
}
p.setLat(lat);
System.out.println("lat: "+lat);
}else if(isLon){
isLon = false;
float lon = 0;
if(sText.length() > 0){
lon = Float.parseFloat(sText);
}
p.setLon(lon);
System.out.println("lon: "+lon);
}else if(isAlt){
isAlt = false;
float alt = 0;
if(sText.length() > 0){
alt = Float.parseFloat(sText);
}
p.setAlt(alt);
System.out.println("alt: "+alt);
}else if(isTipologia){
isTipologia = false;
int tipologia = 0;
if(sText.length() > 0){
tipologia = Integer.parseInt(sText);
}
p.setTipologia(tipologia);
System.out.println("Tipologia: "+tipologia);
}else if(isNome){
isNome = false;
p.setNome(sText);
System.out.println("Nome: "+sText);
}else if(isWiki){
System.out.println("Wiki: "+sText);
isWiki = false;
p.setWikilynk(sText);
System.out.println("p.setWikilynk(sText)!");
}else if(isPoiId){
isPoiId = false;
Long poiId = null;
if(sText.length() > 0){
poiId=Long.parseLong(sText);
}
p.setPoiId(poiId.toString());
System.out.println("PoiId: "+poiId);
}
}
}
__________________
~Breve riferimento ai comandi GNU/Linux (ormai non molto breve...) |
|
|
|
|
|
#18 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
one moment, stò provando
Ultima modifica di e-commerce84 : 01-11-2010 alle 23:58. |
|
|
|
|
|
#19 |
|
Senior Member
Iscritto dal: Feb 2009
Messaggi: 700
|
Ho inserito tutti i System.out che mi avevi detto ma l'output è questo:
Codice:
11-01 23:02:20.318: INFO/System.out(346): E' iniziato il parsing del documento XML 11-01 23:02:20.327: INFO/System.out(346): E' stato aperto il tag: soapenv:Body 11-01 23:02:20.327: INFO/System.out(346): E' stato aperto il tag: getRangePoiResponse 11-01 23:02:20.327: INFO/System.out(346): E' stato aperto getRangePoiReturn 11-01 23:02:20.338: INFO/System.out(346): PoiSaxHandler.startElement null 11-01 23:02:20.348: INFO/System.out(346): E' stato aperto getRangePoiReturn 11-01 23:02:20.348: INFO/System.out(346): PoiSaxHandler.startElement type 11-01 23:02:20.358: INFO/System.out(346): E' stato aperto il tag: item 11-01 23:02:20.358: INFO/System.out(346): E' stato aperto il tag: key 11-01 23:02:20.368: INFO/System.out(346): character(): 0 -> 8 11-01 23:02:20.368: INFO/System.out(346): WikiLink: key --> WikiLink 11-01 23:02:20.378: INFO/System.out(346): E' stato aperto il tag: value 11-01 23:02:20.388: INFO/System.out(346): character(): 0 -> 6 11-01 23:02:20.388: INFO/System.out(346): value: link 2 11-01 23:02:20.398: INFO/System.out(346): Wiki: link 2 11-01 23:02:20.408: INFO/System.out(346): Eccezione -> java.lang.NullPointerException Correggimi se sbaglio...ma è come se entrasse nel primo tag <item> </item> che descrive il campo wikiLink ma poi si incarta in qualcosa e non riesce ad andare oltre negli altri tag <item> |
|
|
|
|
|
#20 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Parma
Messaggi: 3010
|
Vedi che non stampa "p.setWikilynk(sText)!"
I casi sono due: o p == null o c'è un errore nella funzione setWikilynk. Codice:
[...]
}else if(isWiki){
System.out.println("Wiki: "+sText);
isWiki = false;
if(p == null) System.out.println("p è null!!");
else System.out.println("occhettuffai setWikilynk??!!");
p.setWikilynk(sText);
System.out.println("p.setWikilynk(sText)!");
}else if(isPoiId){
[...]
__________________
~Breve riferimento ai comandi GNU/Linux (ormai non molto breve...) |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 21:42.




















