Skip to content

Commit d6c9d6d

Browse files
author
rohan
committed
Added ignore case functionality and catered for more Xpath expressions. Added comments throughout library.
1 parent c0d6696 commit d6c9d6d

File tree

5 files changed

+276
-144
lines changed

5 files changed

+276
-144
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ Contributors
1919

2020
* blumf
2121
* Ivan Baidakou (basiliscos)
22+
* Rohan de Jongh (thepeanutgalleryandco)

Diff for: doc/us/index.html

+9-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ <h2><a name="overview"></a>Overview</h2>
6565

6666
<h2><a name="status"></a>Status</h2>
6767

68-
<p>Current version is 1.2. It was developed for Lua 5.1 based on <a href="http://www.keplerproject.org/luaexpat">
69-
LuaExpat</a> but also should work with Lua 5.2 and 5.3.
68+
<p>Current version is 1.3. It was developed for Lua 5.1 based on <a href="http://www.keplerproject.org/luaexpat">
69+
LuaExpat</a> but also should work with Lua 5.2, 5.3 and 5.4.
7070
</p>
7171

7272

@@ -78,6 +78,13 @@ <h2><a name="download"></a>Download</h2>
7878

7979
<h2><a name="history"></a>History</h2>
8080
<dl class="history">
81+
<dt><strong>Version 1.3</strong> [10/July/2024]</dt>
82+
<dd><ul>
83+
<li>Added ignore case functionality</li>
84+
<li>Added support for more XPath expressions that might be more complex</li>
85+
<li>Added comments in library</li>
86+
</ul></dd>
87+
8188
<dt><strong>Version 1.2</strong> [15/Mar/2015]</dt>
8289
<dd><ul>
8390
<li>Moved to github and a bit reogranized project structure</li>

Diff for: doc/us/manual.html

+26-8
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ <h2><a name="usage"></a>Usage</h2>
7373
require "luaxpath"
7474
local lom = require "lxp.lom"
7575

76-
xpath.selectNodes(lom.parse(xmlString),xpathExpression)
76+
xpath.selectNodes(lom.parse(xmlString),xpathExpression,ignoreCase)
7777
</pre>
7878

7979
<h2><a name="examples"></a>Examples</h2>
@@ -86,19 +86,37 @@ <h2><a name="examples"></a>Examples</h2>
8686
[[
8787
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
8888
&lt;root&gt;
89-
&lt;element id="1" name="element1"&gt;text of the first element&lt;/element&gt;
90-
&lt;element id="2" name="element2"&gt;
91-
&lt;subelement&gt;text of the second element&lt;/subelement&gt;
92-
&lt;/element&gt;
89+
&lt;element id="1" name="element1"&gt;text of the first element&lt;/element&gt;
90+
&lt;element id="2" name="element2"&gt;
91+
&lt;subelement&gt;text of the second element&lt;/subelement&gt;
92+
&lt;/element&gt;
93+
&lt;test:newElement id="1" name="newElement"&gt;text of the new element
94+
&lt;test&gt;text of the test element&lt;/test&gt;
95+
&lt;/test:newElement&gt;
9396
&lt;/root&gt;
9497
]]
9598

96-
-- get all elements
99+
-- get all element nodes
97100
xpath.selectNodes(lom.parse(xmlTest),'//element')
98-
-- get the subelement text
101+
102+
-- get the subelement node's text
99103
xpath.selectNodes(lom.parse(xmlTest),'/root/element/subelement/text()')
100-
-- get the first element
104+
105+
-- get the element with an attribute of "id" that has the value of "1"
101106
xpath.selectNodes(lom.parse(xmlTest),'/root/element[@id="1"]')
107+
108+
-- get the 2nd element node
109+
xpath.selectNodes(lom.parse(xmlTest),'/root/element[2]')
110+
111+
-- get the first element node, with ignoring the case of element
112+
xpath.selectNodes(lom.parse(xmlTest),'/root/ELEMENT[1]',true)
113+
114+
-- get the newElement node and make use of the namespace in the tag name
115+
xpath.selectNodes(lom.parse(xmlTest),'/root/test:newElement')
116+
117+
-- get the node that has a child node that contains a tag name of subelement
118+
xpath.selectNodes(lom.parse(xmlTest),'//element[name="subelement"]')
119+
102120
</pre>
103121

104122
<h2><a name="related_docs"></a>Related documentation</h2>

Diff for: rockspecs/luaxpath-1.2-4.rockspec renamed to rockspecs/luaxpath-1.3-0.rockspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package = "luaxpath"
2-
version = "1.2-4"
2+
version = "1.3-0"
33
source = {
44
url = "git://github.com/basiliscos/lua-xpath",
5-
tag = "v1.2.4",
5+
tag = "v1.3.0",
66
}
77
description = {
88
summary = "Simple XPath implementation in the Lua programming language.",

0 commit comments

Comments
 (0)