summaryrefslogtreecommitdiff
path: root/xmake/core/base/xml.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-15 00:19:32 +0800
committerruki <[email protected]>2025-11-15 00:19:32 +0800
commite8aa6bd86dcfc67fb2fd5d9bb4319a956097f9c1 (patch)
tree7c3cca41a8342c3b7560070fedf1e09140127ac9 /xmake/core/base/xml.lua
parent3d6be9e48846d619bf389ee9a16157281bafa87b (diff)
add more tests
Diffstat (limited to 'xmake/core/base/xml.lua')
-rw-r--r--xmake/core/base/xml.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/xmake/core/base/xml.lua b/xmake/core/base/xml.lua
index 2aa4036b8..84da8e16b 100644
--- a/xmake/core/base/xml.lua
+++ b/xmake/core/base/xml.lua
@@ -385,9 +385,12 @@ function xml.find(node, path)
end
local segments = path:split("/", {strict = true})
local current = {node}
- for _, segment in ipairs(segments) do
+ for idx, segment in ipairs(segments) do
local next_level = {}
for _, parent in ipairs(current) do
+ if parent.name == segment then
+ table.insert(next_level, parent)
+ end
if parent.children then
for _, child in ipairs(parent.children) do
if child.name == segment then
@@ -395,6 +398,13 @@ function xml.find(node, path)
end
end
end
+ if parent.prolog then
+ for _, child in ipairs(parent.prolog) do
+ if child.name == segment then
+ table.insert(next_level, child)
+ end
+ end
+ end
end
if #next_level == 0 then
return nil