开发者

GDataXML write file with xmlns namespace

开发者 https://www.devze.com 2023-03-21 02:26 出处:网络
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.

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 =)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号