【问题标题】:GDataXML write file with xmlns namespace使用 xmlns 命名空间的 GDataXML 写入文件
【发布时间】:2011-10-08 10:44:30
【问题描述】:

我正在使用 GDataXML,但在编写 XML 文件时遇到了一些问题。 我遵循了 Raywenderlich 的教程,但我必须添加一些命名空间。

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

我想做这样的事情:
[FooElement addNamespace:@"xmlns="https://foo/bar/"

在文件中得到这个结果:
xmlns="https://foo/bar/">
xxxx
xxxx
xxxx
xxxx

感谢您的帮助!

【问题讨论】:

    标签: namespaces xml-namespaces gdataxml


    【解决方案1】:

    我找到了解决办法:

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

    我希望这会有所帮助 =)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-30
      相关资源
      最近更新 更多