xmerl_xpath(3erl)

πŸ“¦
version 25.3.2.8 Β· 4 versions
, in ubuntu noble

πŸ’… 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