Voici un fichier XML que je veux importer dans Cocoa:XML Importation sur les questions Cocoa
<?xml version='1.0'?>
<Root xmlns='http://www.abc.uk' version='1.0' name='full'>
<child1 version='2.0'>
<value1>
<user>abc</user>
<pass>xyz</pass>
</value1>
</child1>
<child2>
<imp>12345</imp>
</child2>
</Root>
Maintenant, si j'ajouter toutes les informations XML en utilisant le type de code suivant:
NSXMLElement *root = [[NSXMLElement alloc] initWithName:@"Root"];
[root addAttribute:[NSXMLNode attributeWithName:@"xmlns" stringValue:@"NSXMLElement
[root addAttribute:[NSXMLNode attributeWithName:@"version" stringValue:@"2.0"]];
[root addAttribute:[NSXMLNode attributeWithName:@"name" stringValue:@"full"]];
NSXMLElement *childElement1 = [[NSXMLElement alloc] initWithName:@"child1"];
[childElement1 addAttribute:[NSXMLNode attributeWithName:@"version"
stringValue:@"2.0"]];
[root addChild:childElement1];
[childElement1 release];
Cela ne ne pas créer le XML comme je le voudrais. La fin XML ressemble à:
<?xml version='1.0'?>
<Root xmlns='http://www.abc.uk' version='1.0' name='full'>
<child1 version='2.0'> </child1>
<value1> </value1>
<user>abc</user>
<pass>xyz</pass>
<child2></child2>
<imp>12345</imp>
</Root>
Comment l'entrer correctement? Merci
doh. Merci, je vais essayer. – ZionKing