开发者

How can I recursive traverse an XML-File in Objective-C?

开发者 https://www.devze.com 2023-03-22 23:48 出处:网络
I 开发者_JAVA技巧got the following XML-Structure: <categories> <category> <name>Category_1</name>

I 开发者_JAVA技巧got the following XML-Structure:

<categories>
    <category>
        <name>Category_1</name>
        <ID>100</ID>
        <SubCategories>
            <category>
                <name>Category_2</name>
                <ID>101</ID>
                <SubCategory>
                    <category>
                        <name>Category_3</name>
                        <ID>102</ID>
                        <SubCategory></SubCategory>
                    </category>
                </SubCategory>
            </category>
        </SubCategories>
    </category>
</categories>

I want to parse this file and write every element into a database. I use TouchXML to do the parsing because it is fast and easy to use but I don't know if is the right parser. It would be great if someone can help me.

Thank you!


The "native Cocoa" way to parse XML is with an NSXMLParser.

On the other hand, if you're familiar with TouchXML and it's "fast and easy to use", are you sure you need to switch to something else?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号