0

I am new to android .I have worked with JSON data but have never worked with XML data.The tutorials on the web show xml data which are simple and have no attribute value in the tag.

Like:

<?xml version="1.0" encoding="UTF-8"?>
02  <catalog>
03      <book id="001" lang="ENG">
04          <isbn>23-34-42-3</isbn>
05          <regDate>1990-05-24</regDate>
06          <title>Operating Systems</title>
07          <publisher country="USA">Pearson</publisher>
08          <price>400</price>
09          <authors>
10              <author>Ganesh Tiwari</author>
11          </authors>
12      </book>
13      <book id="002">
14          <isbn>24-300-042-3</isbn>
15          <regDate>1995-05-12</regDate>
16          <title>Distributed Systems</title>
17          <publisher country="Nepal">Ekata</publisher>
18          <price>500</price>
19          <authors>
20              <author>Mahesh Poudel</author>
21              <author>Bikram Adhikari</author>
22              <author>Ramesh Poudel</author>
23          </authors>
24          </book>
25  </catalog>

But the data that i have been given is like this:

How do i parse data with attributes as above?

Achuthan M
  • 187
  • 1
  • 1
  • 12

1 Answers1

0

You can use Ksoap2 to parse soap objects. Some good tutorials are here and here

Waqar Khan
  • 468
  • 4
  • 18
  • The above tutorials are for passing data to the server and getting values.My requirement is to parse xml data.In my case the xml tags are not regular xml tags.That is the issue. – Achuthan M Dec 08 '14 at 05:46
  • The xml you pasted is not the simple xml but a SoapEnvelope. First parse it to SoabObject using `SoapObject obj = (SoapObject)envelope.bodyIn;` – Waqar Khan Dec 08 '14 at 05:52