Issue with displaying URI prefixes on child elements using NSXML
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