Method: LibXML::XML::HTMLParser#parse

Defined in:
ext/libxml/ruby_xml_html_parser.c

#parseXML::Document

Parse the input XML and create an XML::Document with it’s content. If an error occurs, XML::Parser::ParseError is thrown.

Returns:



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'ext/libxml/ruby_xml_html_parser.c', line 60

static VALUE rxml_html_parser_parse(VALUE self)
{
  xmlParserCtxtPtr ctxt;
  VALUE context = rb_ivar_get(self, CONTEXT_ATTR);
  
  Data_Get_Struct(context, xmlParserCtxt, ctxt);

  if (htmlParseDocument(ctxt) == -1 && ! ctxt->recovery)
  {
    rxml_raise(&ctxt->lastError);
  }

  rb_funcall(context, rb_intern("close"), 0);

  return rxml_document_wrap(ctxt->myDoc);
}