ref: 524f6890a72aa3629cc91ecf5c505ffa52f7eda4
dir: /xpath/
.TH XPATH 2 .SH NAME xmllookpath \- XPath support .SH SYNOPSIS .de PB .PP .ft L .nf .. .PB #include <u.h> #include <libc.h> #include <xml.h> #include <xpath.h> .PB enum { Xelem = 1, Xstring = 2, Xnum = 3, } .PB struct XpResult { int type; /* type of XpResult */ int error; /* 1 if error. Check errstr */ int num; /* number of results */ union { /* array of results */ char **strings; /* if type == Xstring */ Elem **elems; /* if type == Xelems */ int *numbers; /* if type == Xnum */ }; ... }; .PB .PD 0 .ta +\w'\fLXpResult 'u XpResult xmllookpath(Elem *ep, char *xpath) void xmlfreeresult(XpResult *r) .SH DESCRIPTION .PP .I Libxpath is an extension library to .IR libxml . It provides XPath functionality for looking up certain nodes in an existing in-memory XML DOM model. .PP .I Xmllookpath is the main function for querying the XML document using an XPath string. It's using .I ep as the reference element within the DOM model. .PP The resulting .I XpResult holds the typed results as an array depending on the type. The allocated array will hold .I num items. If .I error is set, .I errstr contains the description of the error. .PP .I Xmlfreeresult frees and resets the specified .I XpResult structure. .SH SOURCE /sys/src/libxpath .SH "SEE ALSO" .IR xml (2), .IR errstr (2). .SH BUGS The current implementation of XPath is incomplete and very limited. It should be possible to extend the parser to cover a full set of functionality.