I am creating an NSXMLDocument, from which I get a file defined in a constant USER_PRINTXML_URL, as follows:
NSXMLDocument *ads_user_printxml = [[NSXMLDocument alloc] initWithContentsOfURL: [NSURL URLWithString:USER_PRINTXML_URL] options:(NSXMLNodePreserveWhitespace|NSXMLNodePreserveCDATA) error:&ads_err];
Then I use XPath to get to the desired location in the XML file, as follows:
NSArray* ipp_folder = [[ads_user_printxml nodesForXPath:@".//root/printing/IPP"error:&ads_err] objectAtIndex:0];
Now, if I want to add NSXMLElements after the element in the XML file, how do I do it?
I have tried to do the following:
NSXMLElement *s= [ipp_folder objectAtIndex:0];
But this is generating a run time error. I also tried using an NSXMLNode instead of putting the data in an NSArray but again to no avail. I believe the solution is quite simple, but I can't for the life of me find an answer in the docs.
Thanks for any help.