• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Issue with displaying URI prefixes on child elements using NSXML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue with displaying URI prefixes on child elements using NSXML


  • Subject: Issue with displaying URI prefixes on child elements using NSXML
  • From: Lawrence Johnston <email@hidden>
  • Date: Tue, 10 Jun 2008 22:19:34 -0700

Hey everybody, I've got an issue that I can't figure out.

If I'm using this code:

NSString *XMLForDisplay {

NSXMLElement *root = [NSXMLNode elementWithName:@"root"];
[root addNamespace:[NSXMLNode namespaceWithName:@"a" stringValue:@"http://www.tempurl.com "]];


NSXMLElement *child = [NSXMLNode elementWithName:@"child" URI:@"http://www.tempurl.com "];
[child addChild:[NSXMLNode textWithStringValue:@"myText"]];


  [root addChild:child];

  return [root XMLStringWithOptions:NSXMLNodePrettyPrint];
}


I believe it should be outputting this text:

<root xmlns:a="http://www.tempurl.com";>
  <a:child>myText</a:child>
</root>

However, instead it outputs this text (note the lack of prefix on the child):

<root xmlns:a="http://www.tempurl.com";>
  <child>myText</child>
</root>

This is an issue, because I need that "a:" prefix.

The documentation for elementWithName:URI: states it's equivalent to <URI:name></URI:name>, which is exactly what I want, except that I can't get it to display that way.

Thanks for your time.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Issue with displaying URI prefixes on child elements using NSXML
      • From: Chris Suter <email@hidden>
  • Prev by Date: Re: crash on command-W
  • Next by Date: Re: Updating a progress bar from a code loop
  • Previous by thread: Re: A simple doubt about array
  • Next by thread: Re: Issue with displaying URI prefixes on child elements using NSXML
  • Index(es):
    • Date
    • Thread