2011-07-11 27 views
0

私はこのXMLで1つのXMLを解析する必要があるアプリケーションを開発していますが、どのくらいの要素がわかりません。私は任意の要素をクリックすると、それらのサブ要素です&また、私はこのサブセクションでどのくらいの要素がわからないまた、私はどのくらいのサブセクションがわからない動的XML解析

ここでは、ダイナミック解析

<subject> 
<subject_count>5</subject_count> 
<subject_image>http://50.17.184.57/wm911/index4.jpeg</subject_image> 
<subject_name>MCA</subject_name> 
<subject_image>http://50.17.184.57/wm911/index4.jpeg</subject_image> 
<subject_name>BCA</subject_name> 
<subject_image>http://50.17.184.57/wm911/index4.jpeg</subject_image> 
<subject_name>BSc</subject_name> 
<subject_image>http://50.17.184.57/wm911/index4.jpeg</subject_image> 
<subject_name>engg</subject_name> 
<subject_image>http://50.17.184.57/wm911/index4.jpeg</subject_image> 
<subject_name>BBA</subject_name> 
<subject> 




<topic> 

<topic1> 
<topic_count>3</topic_count> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>Adv C</topic_name> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>Objective C</topic_name> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>Java</topic_name> 
</topic1> 

<topic2> 
<topic_count>4</topic_count> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>C</topic_name> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>C++</topic_name> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>.Net</topic_name> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>network</topic_name> 
</topic2> 


<topic3> 
<topic_count>2</topic_count> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>sic</topic_name> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>computer</topic_name> 
</topic3> 



<topic4> 
<topic_count>2</topic_count> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>math</topic_name> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>Adv computers</topic_name> 
</topic4> 


<topic5> 
<topic_count>1</topic_count> 
<topic_image>http://50.17.184.57/wm911/index4.jpeg</topic_image> 
<topic_name>management</topic_name> 
</topic5> 

</topic> 





    <sub_topic> 

    <topic1.1> 
    <sub_topic_count>2</sub_topic_count> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>C program</sub_topic_name> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>system programing</sub_topic_name> 
    </topic1.1> 


<topic1.2> 
<sub_topic_count>3</sub_topic_count> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>XML parsing</sub_topic_name> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>Table</sub_topic_name> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>ipad</sub_topic_name> 
    </topic1.2> 


    <topic1.3> 
    <sub_topic_count>2</sub_topic_count> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>Java1</sub_topic_name> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>java2</sub_topic_name> 
    </topic1.3> 


    <topic2.1> 
    <sub_topic_count>2</sub_topic_count> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>POP</sub_topic_name> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>basic C</sub_topic_name> 
</topic2.1> 


<topic2.2> 
<sub_topic_count>2</sub_topic_count> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>OOP</sub_topic_name> 
<sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>basic C++</sub_topic_name> 
    </topic2.2> 

    <topic2.3> 
    <sub_topic_count>3</sub_topic_count> 
<textname> TEXT1 </textname> <sub_topic_image>http://50.17.184.57/wm911/index4.jpeg</sub_topic_image> 
<sub_topic_name>.Net2</sub_topic_name> 
<video_url>http://192.168.1.128/xml/video/Citizen_7_Trailer_Mayor_09_07_10.m4v </video_url> 
</topic2.3> 

<topic2.4> 
<sub_topic_count>2</sub_topic_count> 
    <pdf_url>http://50.17.184.57/wm911/STTcourse.pdf<pdf_url> 
    <ppt_url>http://192.168.1.128/xml/doc/PPT_SAMPLE.ppt </ppt_url> 

</topic2.4> 

</sub_topic> 

答えて

0

は、XMLを解析する方法については、AppleのXMLPerformanceソースコードを見てみましょう。

0

私はGomathiと完全に同意します。これらのリンクには、query writtingが必要です。

あなたのためにいくつかのサンプルコード..

xPathQuery.h プロジェクトにxPathQuery.hとxPathQuery.mを配置した後、あなただけの

にNSArray *結果= PerformXMLXPathQuery(yourxmlDataObject、xpathQuery)を呼び出します。

あなたは結果の配列を取得します。すべて最高