Thanks, I have no idea how I missed that.
Exactly what I was looking for!
Andrew
On Aug 28, 2008, at 9:40 PM, Graff wrote:
On Aug 28, 2008, at 3:11 PM, Andrew R. Kinnie wrote:
I am attempting to programmatically create an html (rather, xhtml)
document using NSXMLDocument, NSXMLElement, etc.
I am able to create the document and it works, but I am not sure
how to create text which is not inside a paragraph or another tag
which can be a node.
You can do that with the NSXMLNode class method textWithStringValue:
example:
NSXMLElement *root = (NSXMLElement *)[NSXMLNode
elementWithName:@"test"];
NSXMLDocument *aDoc = [[NSXMLDocument alloc]
initWithRootElement:root];
[root addChild:[NSXMLNode textWithStringValue:@"some text"]];
NSString *aFile = [@"~/Desktop/test.txt"
stringByExpandingTildeInPath];
[[aDoc XMLData] writeToFile:aFile atomically:YES];
result:
<test>some text</test>
- Ken Bruno
_______________________________________________
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 [EMAIL PROTECTED]