GDataXML write file with xmlns namespace
I'm using GDataXML and I encounter some problems to write a XML file. I followed Raywenderlich's tutorial but i have to add some namespaces.
for example after this:
[FooElement addChild:bar1Element]; [FooElement addChild:bar2Element]; [FooElement addChild:bar3Element]; [FooElement addChild:bar4Element];i would like to do something like that:
[FooElement addNamespace:@"xmlns="https://foo/bar/"to get this result in file:
< Foo xmlns="https://foo/bar/"> < bar1 > xxxx < /bar1 > < ba开发者_如何学Gor2 > xxxx < /bar2 > < bar3 > xxxx < /bar3 > < bar4 > xxxx < /bar4 > < /Foo >thanks for help !
i found a solution:
GDataXMLElement *FooElement = [GDataXMLNode elementWithName:@"Foo"];
NSArray *namespaces = [[NSArray alloc]
initWithObjects:[GDataXMLNode namespaceWithName:nil
stringValue:@"https://foo/bar/"], nil];
[FooElement setNamespaces:namespaces];
I hope this will help =)
精彩评论