title: libxml2 HTML parsing problems
body: <p>I'm using libxml2 to parse HTML:</p>
  
  <pre><code>static htmlSAXHandler simpleSAXHandlerStruct = {
      NULL,                       /* internalSubset */
      NULL,                       /* isStandalone   */
      NULL,                       /* hasInternalSubset */
      NULL,                       /* hasExternalSubset */
      NULL,                       /* resolveEntity */
      NULL,                       /* getEntity */
      NULL,                       /* entityDecl */
      NULL,                       /* notationDecl */
      NULL,                       /* attributeDecl */
      NULL,                       /* elementDecl */
      NULL,                       /* unparsedEntityDecl */
      NULL,                       /* setDocumentLocator */
      NULL,                       /* startDocument */
      NULL,                       /* endDocument */
      NULL,                       /* startElement*/
      NULL,                       /* endElement */
      NULL,                       /* reference */
      charactersFoundSAX,         /* characters */
      NULL,                       /* ignorableWhitespace */
      NULL,                       /* processingInstruction */
      NULL,                       /* comment */
      NULL,                       /* warning */
      errorEncounteredSAX,        /* error */
      NULL,                       /* fatalError //: unused error() get all the errors */
      NULL,                       /* getParameterEntity */
      NULL,                       /* cdataBlock */
      NULL,                       /* externalSubset */
      XML_SAX2_MAGIC,             //
      NULL,
      startElementSAXP,           /* startElementNs */
      endElementSAXP,             /* endElementNs */
      NULL,                       /* serror */
  };
  </code></pre>
  
  <p>The <code>charactersFoundSAX</code> and <code>errorEncounteredSAX</code> functions do get called, but the <code>startElementSAXP</code> and <code>endElementSAXP</code> functions never get called.</p>
  
  <p>If I change the parsing from HTML and parse XML instead (and change all the definitions including 'html' to 'xml', e.g. into <code>xmlSAXHandler</code>), the functions do get called correctly.</p>
  
  <p>Why is that?</p>