Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer Help > Re: Tiger bug i...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 14 Topic 3726 of 3882
Post > Topic >>

Re: Tiger bug in NSXMLParser?

by David Phillip Oster <oster@[EMAIL PROTECTED] > Apr 28, 2008 at 10:07 PM

In article 
<lazloman-91EB72.20371028042008@[EMAIL PROTECTED]
>,
 Can I Get a Word In <lazloman@[EMAIL PROTECTED]
> wrote:

> I'm using NSXMLParser to read an XML do***ent from a server via 
> initiWithContentsOfURL. This works just fine under Leopard. I can read 
> and parse the data just fine, but under Tiger, I get an empty do***ent 
> error: NSXMLParserErrorDomain = 4 (Empty do***ent). There are several 
> posts in the archives about problems with NSXMLParser, but nothing 
> suggesting a Tiger bug leading to an empty do***ent. Unless someone 
> thinks there's something wrong with my code, I'm going to file a bug 
> with Apple.
> 
> Here is my code:
> NSXMLParser* locationData = [[[XMLParser alloc] 
> initWithContentsOfURL:[NSURL URLWithString:urlString]]  autorelease];
> [locationData setDelegate:self];
> [locationData parse];
> NSError* err = [locationData parseError]; <---Empty do***ent error
> 
> 
> urlString is an NSString that was created using 
> stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding
> 
> The do***ents encoding is actually Latin1, I pasted the last one I tried

> here. I've tried a few encodings, but they all fail with the same error.
> Any ideas?

Do an NSData initWithContentsOfURL:, and see if you can convert it to a 
UTF8String, If you can't, you certainly couldn't expect NSXMLParser to 
handle it.

Save the NSData to a file, and use the command line tool:

tidy -e -xml -utf8 inFile

and it will tell you about malformed XML.
 




 14 Posts in Topic:
Tiger bug in NSXMLParser?
Can I Get a Word In <l  2008-04-28 20:37:10 
Re: Tiger bug in NSXMLParser?
David Phillip Oster <o  2008-04-28 22:07:55 
Re: Tiger bug in NSXMLParser?
Lorenzopt <lorenzo@[EM  2008-04-29 12:20:54 
Re: Tiger bug in NSXMLParser?
Can I Get a Word In <l  2008-04-29 20:18:40 
Re: Tiger bug in NSXMLParser?
David Phillip Oster <o  2008-04-29 20:02:39 
Re: Tiger bug in NSXMLParser?
Tom Harrington <tph@[E  2008-04-30 09:22:04 
Re: Tiger bug in NSXMLParser?
Lorenzopt <lorenzo@[EM  2008-04-30 11:20:49 
Re: Tiger bug in NSXMLParser?
Tom Harrington <tph@[E  2008-04-30 12:57:32 
Re: Tiger bug in NSXMLParser?
Lorenzopt <lorenzo@[EM  2008-05-01 10:25:17 
Re: Tiger bug in NSXMLParser?
David Phillip Oster <o  2008-05-01 19:25:01 
Re: Tiger bug in NSXMLParser?
Lorenzopt <lorenzo@[EM  2008-04-30 10:14:39 
Re: Tiger bug in NSXMLParser?
Sherman Pendley <spamt  2008-05-02 00:49:43 
Re: Tiger bug in NSXMLParser?
Tom Harrington <tph@[E  2008-04-29 13:53:10 
Re: Tiger bug in NSXMLParser?
Can I Get a Word In <l  2008-04-29 20:16:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 10:59:25 CST 2008.