Re: Help with CFXMLTreeCreateFromData with an NSMutableURLRequest response.
Re: Help with CFXMLTreeCreateFromData with an NSMutableURLRequest response.
- Subject: Re: Help with CFXMLTreeCreateFromData with an NSMutableURLRequest response.
- From: Scott Andrew <email@hidden>
- Date: Sat, 19 Mar 2005 17:01:00 -0800
On 3/19/05 12:41 PM, "Chris Parker" <email@hidden> wrote:
>
> On Mar 19, 2005, at 1:58 AM, Scott Andrew wrote:
>
>> I am tyring to write some code that will parse XML that I have
>> downloaded
>> form a secure server. The trick is I have to be logged into the
>> server and
>> use cookies so I need to sue the NSMutableURLRequests so my cookies
>> are
>> used.
>>
>> NSString *urlString=[[NSString alloc]
>> initWithString:@"http://www.pbase.com/client?view=galleries"];
>>
>> NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:
>> [NSURL
>> URLWithString:urlString]];
>>
>> NSURLResponse* response;
>>
>> NSData* result = [NSURLConnection sendSynchronousRequest:request
>> returningResponse:&response
>> error:&error];
>>
>>
>> CXMLTreeRef dataTree = CFXMLTreeCreateFromData (kCFAllocatorDefault,
>> (CDataRef)result,
>> NULL,
>>
>> kCFXMLParserSkipWhitespace,
>>
>> kCFXMLNodeCurrentVersion)
>>
>> My dataTree is NULL. I can convert my data to string and see the XML.
>> Getting the XML from a URL is not an option since I have to be
>> logged into
>> the server with cookies.
>
> If you use CFXMLTreeCreateFromDataWithError and examine the resulting
> dictionary, what does it tell you?
>
> .chris
>
>
Ok so using CXMLTreeCreateFromDataWithError returns a line number of 118 and
an error of: Encountered malformed start tag. What is wrong the XML I am
getting back from Safari has the a line of <Title>BBS Lounge &
Others</Title>. The site allows speical characters but doesn't return them
tokenized correctly.. They come across as < or & not &.. I might end up
having to write my own parser for this XML.. Using ie I get the XML the same
way..
_______________________________________________
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