lundi 2 mars 2015

How do I parse XML String as Objects with states?

I have the followin code:



BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;


Blockquote



StringBuffer response = new StringBuffer();
while((inputLine = in.readLine()) != null){
response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Output:
"<?xml version="1.0"?><query id="19247955" amount="10" points="44"></query><query id="19247830" amount="3" points="44"></query>"


I want to parse it to Objects with such states as Id, Amount and Points. I tried to use "DOM and a StringReader", but tags are empty so I failed.


Aucun commentaire:

Enregistrer un commentaire