加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

名称空间 – 使用xmlns名称空间的GDataXML写入文件

发布时间:2020-12-16 22:59:37 所属栏目:百科 来源:网络整理
导读:我正在使用GData XML,我遇到了编写 XML文件的一些问题. 我按照Raywenderlich的教程,但我必须添加一些名称空间. 例如在此之后: ????[FooElement addChild:bar1Element]; ????[FooElement addChild:bar2Element]; ????[FooElement addChild:bar3Element];
我正在使用GData XML,我遇到了编写 XML文件的一些问题.
我按照Raywenderlich的教程,但我必须添加一些名称空间.

例如在此之后:
????[FooElement addChild:bar1Element];
????[FooElement addChild:bar2Element];
????[FooElement addChild:bar3Element];
????[FooElement addChild:bar4Element];

我想做那样的事情:
????[FooElement addNamespace:@“xmlns =”https:// foo / bar /“

将此结果存入文件:
????< Foo xmlns =“https:// foo / bar /”>
????????< bar1> xxxx< / bar1>
????????< bar2> xxxx< / bar2>
????????< bar3> xxxx< / bar3>
????????< bar4> xxxx< / bar4>
?????< / Foo>

感谢帮助 !

解决方法

我找到了解决方案:

GDataXMLElement *FooElement = [GDataXMLNode elementWithName:@"Foo"];
NSArray *namespaces = [[NSArray alloc] 
      initWithObjects:[GDataXMLNode namespaceWithName:nil    
      stringValue:@"https://foo/bar/"],nil];
[FooElement setNamespaces:namespaces];

我希望这会有所帮助=)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读