Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

hello world
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <libxml/HTMLparser.h>
int main(int argc, char* argv[]) {
printf("parsing %s\n", argv[1]);
htmlDocPtr doc = htmlReadFile((const char *)argv[1], NULL,
xmlXPathContextPtr xpathCtx = xmlXPathNewContext(doc);
xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression("//p", xpathCtx);
printf("found %d nodes\n", xpathObj->nodesetval->nodeNr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.