How to parse complex xml in android using XMLPullParser?

126 views Asked by At

I am having following XML which contains many "packet" as Start Tags. I need to parse for <proto name="ip" and get the show values of <field name e.g "ip.len" , "ip.id", <field name="ip.proto ........'

Need some suggestion about the same... code block: <packet> <proto name="ip" showname="Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)" size="20" pos="14"> <field name="ip.version" showname="Version: 4" size="1" pos="14" show="4" value="45"/> <field name="ip.hdr_len" showname="Header Length: 20 bytes" size="1" pos="14" show="20" value="45"/> <field name="ip.dsfield" showname="Differentiated Services Field: 0xb8 (DSCP 0x2e: Expedited Forwarding; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))" size="1" pos="15" show="184" value="b8"> <field name="ip.dsfield.dscp" showname="1011 10.. = Differentiated Services Codepoint: Expedited Forwarding (0x2e)" size="1" pos="15" show="46" value="2E" unmaskedvalue="b8"/> <field name="ip.dsfield.ecn" showname=".... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)" size="1" pos="15" show="0" value="0" unmaskedvalue="b8"/> </field> <field name="ip.len" showname="Total Length: 1566" size="2" pos="16" show="1566" value="061e"/> <field name="ip.id" showname="Identification: 0x0000 (0)" size="2" pos="18" show="0" value="0000"/> <field name="ip.flags" showname="Flags: 0x02 (Don&apos;t Fragment)" size="1" pos="20" show="2" value="40"> <field name="ip.dst_host" showname="Destination Host: 127.0.0.1" hide="yes" size="4" pos="30" show="127.0.0.1" value="7f000001"/> <field name="ip.host" showname="Source or Destination Host: 127.0.0.1" hide="yes" size="4" pos="30" show="127.0.0.1" value="7f000001"/> <field name="" show="Source GeoIP: Unknown" size="4" pos="26" value="7f000001"/> <field name="" show="Destination GeoIP: Unknown" size="4" pos="30" value="7f000001"/> </proto> </packet>

0

There are 0 answers