我有以下xml,我需要使用TouchXML解析。TouchXML問題
<?xml version="1.0"?>
<categories>
<category0>
<title>Alcoholic Drinks</title>
<description>Buy beers, wines, sprits and champagne from the top online alocholic drink stores.
Whatever your tipple you are sure to find a drinks supplier from our top shops below:
</description>
<status>1</status>
<popularStatus></popularStatus>
<order></order>
<link>alcoholic-drinks</link>
<id>1</id>
</category0>
<category1>
<title>Art and Collectibles</title>
<description>Are you looking to buy contemporary or fine art, or do you prefer to make your own artwork?&#

Whether type of artwork or craft materials you are looking for, you are certain to find one of the shops below more than helpful:
</description>
<status>1</status>
<popularStatus></popularStatus>
<order></order>
<link>art-and-collectibles</link>
<id>2</id>
</category1>
<category2>
<title>Auctions</title>
<description>Are you looking for the UK's biggest and best Auction Sites?
The team at safebuyer.co.uk have scoured the web to find the UK's favourite auctions, so why wait, start your bidding now!
</description>
...
...
...
我想從根節點創建兩個循環,以獲取標題和鏈接,但coudnt弄清楚如何做到這一點。任何人都可以幫忙嗎?
節點命名爲,等等,所以我不能用你的XPath –
CXMLNode *節點;對於(i = 0; i <10; i ++){NSString * xpath = [NSString stringWithFormat:@「// category%d/title」,i]; NSArray * title = [[nodes nodesForXPath:xpath] stringValue]; } – Cintu