1xmerl_xpath(3)             Erlang Module Definition             xmerl_xpath(3)
2
3
4

NAME

6       xmerl_xpath - The xmerl_xpath module handles the entire XPath 1.0 spec.
7

DESCRIPTION

9       The xmerl_xpath module handles the entire XPath 1.0 spec. XPath expres‐
10       sions typically occur in XML attributes and are used to  address  parts
11       of  an  XML  document. The grammar is defined in xmerl_xpath_parse.yrl.
12       The core functions are defined in xmerl_xpath_pred.erl.
13
14       Some useful shell commands for debugging the XPath parser
15
16        c(xmerl_xpath_scan).
17        yecc:yecc("xmerl_xpath_parse.yrl", "xmerl_xpath_parse", true, []).
18        c(xmerl_xpath_parse).
19
20        xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("position() > -1")).
21        xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("5 * 6 div 2")).
22        xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("5 + 6 mod 2")).
23        xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("5 * 6")).
24        xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("-----6")).
25        xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("parent::node()")).
26        xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("descendant-or-self::node()")).
27        xmerl_xpath_parse:parse(xmerl_xpath_scan:tokens("parent::processing-instruction('foo')")).
28
29

DATA TYPES

31         docEntity() = #xmlDocument{} | [docNodes()]:
32
33
34         docNodes() = #xmlElement{} | #xmlAttribute{} | #xmlText{} |  #xmlPI{}
35         | #xmlComment{} | #xmlNsNode{}:
36
37
38         nodeEntity()   =  #xmlElement{}  |  #xmlAttribute{}  |  #xmlText{}  |
39         #xmlPI{} | #xmlComment{} | #xmlNsNode{} | #xmlDocument{}:
40
41
42         option_list():
43
44
45           Options allows to customize the behaviour of the XPath scanner.
46
47           Possible options are:
48
49           {namespace, #xmlNamespace}:
50             Set namespace nodes, from XmlNamspace, in xmlContext
51
52           {namespace, Nodes}:
53             Set namespace nodes in xmlContext.
54
55         parentList() = [{atom(), integer()}]:
56
57
58         xPathString() = string():
59
60

EXPORTS

62       string(Str, Doc) -> [docEntity()] | Scalar
63
64              Equivalent to string(Str, Doc, []).
65
66       string(Str, Doc, Options) -> [docEntity()] | Scalar
67
68              Equivalent to string(Str, Doc, [], Doc, Options).
69
70       string(Str, Node, Parents, Doc, Options) -> [docEntity()] | Scalar
71
72              Types:
73
74                 Str = xPathString()
75                 Node = nodeEntity()
76                 Parents = parentList()
77                 Doc = nodeEntity()
78                 Options = option_list()
79                 Scalar = #xmlObj{}
80
81              Extracts the nodes from the parsed XML tree according to  XPath.
82              xmlObj  is  a  record  with fields type and value, where type is
83              boolean | number | string
84

AUTHORS

86       <>
87
88
89
90                                 xmerl 1.3.30                   xmerl_xpath(3)
Impressum