Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

saleh.hi.62

macrumors member
Original poster
Jul 25, 2011
95
0
Hello Guys,

I have an Array of dictionaries
Code:
NSMutableArray* list = [NSMutableArray array];
	[list addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"first value",@"text", @"number 1",@"value", nil]];
	[list addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"second value",@"text", @"number 2",@"value", nil]];
	[list addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"third value",@"text", @"number 3",@"value", nil]];

And with this command i made an XML file

Code:
	[list writeToFile:path atomically:YES];

Code:
<plist version="1.0">
<array>
	<dict>
		<key>text1</key>
		<string>first value</string>
		<key>value</key>
		<string>number 1</string>
	</dict>
	<dict>
		<key>text2</key>
		<string>second value</string>
		<key>value</key>
		<string>number 2</string>
	</dict>
	<dict>
		<key>text3</key>
		<string>third value</string>
		<key>value</key>
		<string>number 3</string>
	</dict>
</array>
</plist>

Here is my question!

here is the way it represent the keys and values here,but how can i convert this tags :
Code:
<key>text3</key>
<string>third value</string>
to this form:
Code:
<text3>third value</text3>

when i want to create them ?
 
You either create a routine to convert the XML created by writeToFile or perhaps you subclass NSMutableArray to override the writeToFile method.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.