xmerl_xpath(3erl)
π xmerl_xpath π
okay bestie, welcome to the xmerl_xpath page β it's an Erlang Module Definition, and the manual page id is xmerl_xpath(3erl). yes, we're doing XPath 1.0 today. π
β¨ NAME β¨
xmerl_xpath β the module that handles the entire XPath 1.0 spec. periodt. π
πΈ DESCRIPTION πΈ
okay so xmerl_xpath handles the entire XPath 1.0 spec. XPath expressions typically occur in XML attributes and are used to address parts of an XML document. The grammar is defined in xmerl_xpath_parse.yrl. The core functions are defined in xmerl_xpath_pred.erl. no cap, that's the whole map. πΊοΈ
Some useful shell commands for debugging the XPath parser:
c(xmerl_xpath_scan).
yecc:yecc("xmerl_xpath_parse.yrl", "xmerl_xpath_parse", true, []).
c(xmerl_xpath_parse).
xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("position() > -1")).
xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("5 * 6 div 2")).
xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("5 + 6 mod 2")).
xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("5 * 6")).
xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("-----6")).
xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("parent::node()")).
xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("descendant-or-self::node()")).
xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("parent::processing-instruction('foo')")).
π¦ DATA TYPES π¦
here's the type tea, served exactly as written:
docEntity() = #xmlDocument{} | [docNodes()]:
docNodes() = #xmlElement{} | #xmlAttribute{} | #xmlText{} | #xmlPI{} |
#xmlComment{} | #xmlNsNode{}:
nodeEntity() = #xmlElement{} | #xmlAttribute{} | #xmlText{} | #xmlPI{}
| #xmlComment{} | #xmlNsNode{} | #xmlDocument{}:
parentList() = [{atom(), integer()}]:
xPathString() = string():
option_list(): β okay, Options allows to customize the behaviour of the XPath scanner. Possible options are:
{namespace, #xmlNamespace}β Set namespace nodes, from XmlNamspace, in xmlContext{namespace, Nodes}β Set namespace nodes in xmlContext.
π EXPORTS π
π string(Str, Doc) -> [docEntity()] | Scalar
Equivalent to string(Str, Doc, []).
π string(Str, Doc, Options) -> [docEntity()] | Scalar
Equivalent to string(Str, Doc, [], Doc, Options).
π string(Str, Node, Parents, Doc, Options) -> [docEntity()] | Scalar
Types:
Str = xPathString()Node = nodeEntity()Parents = parentList()Doc = nodeEntity()Options = option_list()Scalar = #xmlObj{}
Extracts the nodes from the parsed XML tree according to XPath. xmlObj is a record with fields type and value, where type is boolean | number | string.
π AUTHORS π
the authors field is literally <> β iconic empty-energy moment. π«Ά
okay that's the whole page, bestie. π source/version: xmerl 1.3.31.1; page: xmerl_xpath(3erl). go forth and address XML parts like a main character. β¨
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms