title: Accessing DOM Webkit Objective C
body: <p>Could someone who is familiar with webkit please explain or point me in the right direction as to why the following code does not work</p>
  
  <p>What i'm trying to do is load a page, have webkit parse it and simply print out the title.</p>
  
  <p>Here is what i've got:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;WebKit/WebKit.h&gt;
  
  using namespace std;
  
  /*
   Seek Help
  */
  int main (int argc, char * const argv[]) {      
      NSAutoreleasePool    *autoreleasepool = [[NSAutoreleasePool alloc] init];
  
       WebFrame * mainFrame;
       WebView * view = [[WebView alloc] initWithFrame: NSMakeRect (0,0,640,480)];
  
      mainFrame = [view mainFrame];
      NSString * url = @"http://test.com";
      [[view mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
  
      NSString * data = @"&lt;html&gt;&lt;head&gt;&lt;title&gt;testing&lt;/title&gt;&lt;/head&gt;&lt;body&gt;tester&lt;/body&gt;&lt;/html&gt;";
      [[view mainFrame] loadHTMLString:data baseURL: nil];
  
      // NSString * urlString = [[NSString alloc] initWithUTF8String:"&lt;html&gt;&lt;head&gt;&lt;title&gt;Hello World&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;My first Web page.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"];
  
      //[[view mainFrame] loadHTMLString:urlString baseURL:nil];    
  
      NSString * outerHtml = [(DOMHTMLElement *)[[[view mainFrame] DOMDocument] documentElement] innerHTML];
  
       cout &lt;&lt; "Html: " &lt;&lt; [outerHtml UTF8String] &lt;&lt; endl;
  
      NSString * title = [view mainFrameTitle];
  
      cout &lt;&lt; "title: " &lt;&lt; [title UTF8String] &lt;&lt; endl;
  
      [autoreleasepool release];
  
       return 0;
  }
  </code></pre>
  
  <p>The output is both html and title are blank</p>
  
  <p>Thank You for reading</p>