I have following NSXMLDocument:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<parent name=“abcd“>
<content>
<number>1234</number>
</content>
</parent>
Now I would like to add another NSXMLElement directly behind the first <number>
-entry
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<parent name=“abcd“>
<content>
<number>1234</number>
<number>5678</number>
</content>
</parent>
Just expected that I have to implement something like that, but it doesn’t work.
NSXMLElement *number = [[NSXMLElement alloc] initWithName:@“number“];
[number setStringValue:@“5678“];
NSXMLNode *parent = [xmlDoc childAtIndex:0];
NSXMLNode *content = [parent childAtIndex:0];
[content insertChild:number atIndex:1];
How can I add the new node/element to the NSXMLDocument?