Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

WebFrame's loadRequest vs loadData



I'm trying to better understand (and debug) the page load process. I have an xml file that loads an xsl stylesheet to convert it to html. When I use the following line, it works as expected:

const NSURL* fileURL = 
[NSURL URLWithString:@"myxml.xml" relativeToURL:absoluteURL];

[mainFrame loadRequest:[NSURLRequest requestWithURL:fileURL]];

but when I try to load the xml into memory so that I can make changes to it before loading, the following fails:

const NSURL* fileURL = 
[NSURL URLWithString:@"myxml.xml" relativeToURL:absoluteURL];

const NSFileHandle* fileHandle = 
[NSFileHandle fileHandleForReadingAtPath:[fileURL path]];

NSMutableString* myXML = [[[NSString alloc] 
initWithData: [fileHandle readDataToEndOfFile] 
encoding: NSUTF8StringEncoding] autorelease];

myXML = [[myXML mutableCopy] autorelease];


// make some changes to the xml via insertString:

[mainFrame loadData:[skinXML dataUsingEncoding:NSUTF8StringEncoding] 
MIMEType:@"text/xml" textEncodingName:@"utf-8" baseURL:absoluteURL];

I've tried using kCFStringEncodingUTF16 (and "utf-16") for the encoding arguments, and fileURL for the baseURL argument, but all forms fail. Even stubbing out the lines that mutate the xml (including the mutableCopy) doesn't work. I've verified that myXML contains the correct contents of the file. Again, loading the same file directly via loadRequest works fine (making the same changes to the xml via text editor prior to execution). How do I duplicate the loadRequest functionality in such a way that I can mutate the xml at runtime?


Thanks!

Jim
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.