• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Tiger bug on NSXMLParser?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tiger bug on NSXMLParser?


  • Subject: Re: Tiger bug on NSXMLParser?
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 28 Apr 2008 18:57:44 -0700


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.


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.

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.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Follow-Ups:
    • Re: Tiger bug on NSXMLParser?
      • From: "Lorenzo Thurman" <email@hidden>
References: 
 >Tiger bug on NSXMLParser? (From: "Lorenzo Thurman" <email@hidden>)

  • Prev by Date: Tiger bug on NSXMLParser?
  • Next by Date: Something like "validation," only not?
  • Previous by thread: Tiger bug on NSXMLParser?
  • Next by thread: Re: Tiger bug on NSXMLParser?
  • Index(es):
    • Date
    • Thread