我有以下 XML,其中包含许多“数据包”作为开始标签。我需要解析<proto name="ip" and get the show values of <field name e.g "ip.len" , "ip.id", <field name="ip.proto ........'
需要一些关于相同的建议......代码块:<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'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>