title: Simple libxml2 HTML parsing example, using Objective-c, Xcode, and HTMLparser.h
body: <p>Please can somebody show me a simple example of parsing some HTML using libxml.</p>
  
  <pre><code>#import &lt;libxml2/libxml/HTMLparser.h&gt;
  
  NSString *html = @"&lt;ul&gt;"
      "&lt;li&gt;&lt;input type=\"image\" name=\"input1\" value=\"string1value\" /&gt;&lt;/li&gt;"
      "&lt;li&gt;&lt;input type=\"image\" name=\"input2\" value=\"string2value\" /&gt;&lt;/li&gt;"
    "&lt;/ul&gt;"
    "&lt;span class=\"spantext\"&gt;&lt;b&gt;Hello World 1&lt;/b&gt;&lt;/span&gt;"
    "&lt;span class=\"spantext\"&gt;&lt;b&gt;Hello World 2&lt;/b&gt;&lt;/span&gt;";
  </code></pre>
  
  <p>1) Say I want to parse the value of the input whose name = input2.</p>
  
  <p>Should output "string2value".</p>
  
  <p>2) Say I want to parse the inner contents of each span tag whose class = spantext.</p>
  
  <p>Should output: "Hello World 1" and "Hello World 2".</p>