Re: Converting HTML entities to NSXMLNode tree
Re: Converting HTML entities to NSXMLNode tree
- Subject: Re: Converting HTML entities to NSXMLNode tree
- From: Timothy Larkin <email@hidden>
- Date: Sat, 3 Sep 2005 15:50:00 -0400
On Sep 3, 2005, at 9:51 AM, Ben Kazez wrote:
So, given a text node containing entity-ized XML, how do I convert
this into an NSXMLNode tree representation of the XML, beneath the
node?
I don't think I fully understand your problem, but I'll give a go at
a solution.
Given an NSString object (xml) containing a string of XML, you can
create an XML tree using
NSXMLDocument *doc = [[NSXMLDocument alloc] initWithXMLString:xml
options:NSXMLNodePrettyPrint
error:nil];
Then you get the doc's root element, an instance of NSXMLElement,
with [NSXMLDocument rootElement]. From there you walk the tree by
iterating over [NSXMLNode children].
Tim Larkin
Abstract Tools
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden