If I have this external XML file:
<drivers>
<folder>
<name>Adobe</name>
<driver>
<name>acrobat distiller 3.0</name>
<filename>ADISTILL.PPD</filename>
</driver>
<driver>
<name>adobe laserjet ii cartridge</name>
<filename>ALJII523.PPD</filename>
</driver>
<driver>
<name>generic postscript printer</name>
<filename>defprtr2.ppd</filename>
</driver>
</folder>
</drivers>
Say I want to get the contents of "Adobe" and put them in an array, how would I do it?
I have the following, which gives me an array of "< name >" however, I don't know what the next step it.
NSString *item_name = [NSString stringWithFormat:@".//drivers/folder/name"];
NSArray *arr = [ads_xml nodesForXPath:item_name error:NULL];
ads_xml is an NSXMLDocument type.
Thanks!
P.S. Specifically I want the < name > and < filename > found under the < driver > node.. Cheers
I found the solution myself, which can be done in a number of different ways. I can create array for all the names, using XPath and another array for the filename, and store the data in array variables that way.