childAtIndex:
指定した番号の子アイテムを返します
-(NSXMLNode *)childAtIndex:(unsigned int)index:
解説
指定した番号の子アイテムを返します。
返り値
( NSXMLNode * )
なし
引数
( unsigned int )index
フレームワーク
Foundation
クラス
NSXMLNode
Instance Methods
使用可能
10.4
参照
-childCount
例文
//ルートエレメントを作る NSXMLElement *root = (NSXMLElement *)[NSXMLNode elementWithName:@"addresses"]; //ルートからXMLドキュメントを作る NSXMLDocument *xmlDoc = [[NSXMLDocument alloc] initWithRootElement:root]; [xmlDoc setVersion:@"1.0"]; [xmlDoc setCharacterEncoding:@"UTF-8"]; //ルート NSXMLNode *node1 = [NSXMLNode commentWithStringValue:@"1stchild"]; NSXMLNode *node2 = [NSXMLNode commentWithStringValue:@"2ndchild"]; [root addChild: node1 ]; [root addChild: node2 ]; NSLog(@"childAtIndex0: %@",[[node1 childAtIndex:0] description]);