>Thus, I do the following: > >NSXMLElement rootXmlElement = ... >NSXMLNode *schemaLocationAttributeXmlNode = > [NSXMLNode attributeWithName:@"schemaLocation" URI:@"xsi" >stringValue:@"http://example.com/document document.xsd"];
>So, now, I tried specifying the prefix in the attribute name when >creating the attribute: > >NSXMLElement rootXmlElement = ... >NSXMLNode *schemaLocationAttributeXmlNode = > [NSXMLNode attributeWithName:@"xsi:schemaLocation" >URI:@"http://www.w3.org/2001/XMLSchema-instance" >stringValue:@"http://example.com/document document.xsd"]; > >[rootXmlElement addAttribute:schemaLocationAttributeXmlNode]; > >Success! >This doesn't seem consistent with the documentation. They haven't made it terribly clear, have they? I would have done it like this: NSXMLElement* e = [[NSXMLElement alloc] initWithName: @"document"]; NSXMLNode* def = [NSXMLNode namespaceWithName:@"" stringValue:@"http://example.com/document"]; [e addNamespace:def]; NSXMLNode* xsi = [NSXMLNode predefinedNamespaceForPrefix:@"xsi"]; [e addNamespace:xsi]; NSXMLNode* loc = [NSXMLNode attributeWithName:@"xsi:schemaLocation" stringValue:@"http://example.com/document document.xsd"]; [e addAttribute: loc]; But that does leave one wondering what the URI param is for... m. -- matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/> A fool + a tool + an autorelease pool = cool! Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com