I have a string of HTML that was parsed by libxml2.dylib that looks like:
Hello,<br />\n<br />\nThis is almost HTML.<br />\n<br />\n
I've unsuccessfully tried to display certain strings parsed from the XML in a WebView; I'm hoping there's a simple way to do it such as how an HTML page is displayed in my Cocoa application:
HTMLView.h
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface htmlView : NSObject {
IBOutlet WebView * webview;
}
-(IBAction) showHTML:(id) sender;
@end
HTMLView.m
#import "HTMLView.h"
@implementation htmlView
-(IBAction) showHTML:(id) sender
{
[[webview mainFrame] loadRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://www.example.com"]]];
NSString * string = @"<br>test</br>";
[self loadHTMLString:string baseURL:(NSURL *)baseURL];
}
-(void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL {
}
@end