Re: Tiger bug on NSXMLParser?
Re: Tiger bug on NSXMLParser?
- Subject: Re: Tiger bug on NSXMLParser?
- From: "Lorenzo Thurman" <email@hidden>
- Date: Mon, 28 Apr 2008 22:03:50 -0500
On Mon, Apr 28, 2008 at 8:57 PM, Jens Alfke <email@hidden> wrote:
>
> On 28 Apr '08, at 6:42 PM, Lorenzo Thurman wrote:
>
> NSString* urlString = [str stringByAddingPercentEscapesUsingEncoding:
> > NSUTF8StringEncoding];
> >
>
> You shouldn't need this step if 'str' is already a string representation
> of the URL. For example, it would convert a "?" or "#" in the URL into a
> percent-escaped sequence.
>
Understood, I just thought that was good practice.
>
> NSXMLParser* locationData = [[[XMLParser alloc]
> > initWithContentsOfURL:[NSURL
> > URLWithString:urlString]] autorelease];
> >
>
> Have you tried loading the data first, and then parsing it? Does the data
> look reasonable, i.e. can you convert it to an NSString using the expected
> encoding?
>
> Also, are you sure the XML is valid? XML parsers are very picky, by design
> (unlike Web browsers), and will fail if there are any syntax errors.
>
I'll try these suggestions and get back to you.
>
> If your app doesn't need to run on pre-10.4 systems, you could consider
> using NSXMLDocument instead, which is a newer and more powerful API. It lets
> you use XPath and XQuery to search through the DOM, and it integrates
> libTidy, which will clean up invalid XML and HTML for you.
>
Actually NSXMLDocument will work, and if I have to use it, I will, but the
data I need is all in the attributes and NSXMLParser will give them to me
all nicely wrapped in an NSDictionary for each element, saving a few steps.
Thanks for the reply.
>
> —Jens
--
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
_______________________________________________
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