I am needing to parse an XML file for my app and I dont have any clue how to do it. I went through one XMLParser tutorial, and it worked fine but the XML file in the tutorial was very simple and my XML file is quite a bit more complex.
here is a snippet of the xml file:
<?xml version="1.0" encoding="UTF-8"?>
<digital_tpp cycle="1003" from_edate="0901Z 03/11/10" to_edate="0901Z 04/08/10">
<state_code ID="AK" state_fullname="Alaska">
<city_name ID="ADAK ISLAND" volume="AK-1">
<airport_name ID="ADAK" military="N" apt_ident="ADK" icao_ident="PADK" alnum="1244">
<record>
<chartseq>10100</chartseq>
<chart_code>MIN</chart_code>
<chart_name>TAKE-OFF MINIMUMS</chart_name>
<useraction></useraction>
<pdf_name>AKTO.PDF</pdf_name>
<cn_flg>N</cn_flg>
<cnsection></cnsection>
<cnpage></cnpage>
<bvsection>C</bvsection>
<bvpage></bvpage>
<procuid></procuid>
<two_colored>N</two_colored>
<civil> </civil>
<faanfd15></faanfd15>
<faanfd18></faanfd18>
<copter></copter>
</record>
<record>
<chartseq>10200</chartseq>
<chart_code>MIN</chart_code>
<chart_name>ALTERNATE MINIMUMS</chart_name>
<useraction></useraction>
<pdf_name>AKALT.PDF</pdf_name>
<cn_flg>N</cn_flg>
<cnsection></cnsection>
<cnpage></cnpage>
<bvsection>E</bvsection>
<bvpage></bvpage>
<procuid></procuid>
<two_colored>N</two_colored>
<civil> </civil>
<faanfd15></faanfd15>
<faanfd18></faanfd18>
<copter></copter>
</record>
</airport_name>
</city_name>
</state_code>
</digital_tpp>
What I'm needing to do is search the XML file for the <...icao_ident>
that the user specifies, then create a dictionary containing the <pdf_name>
and <chart_name>
for each <record>
. I will then create a UI that displays the pdf files.
Can someone direct me to a good tutorial or explanation of how XML parser works? Or if I'm going about this the wrong way I'd be open to suggestions too.
(the XML file is about 8MB)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…