From e8aa6bd86dcfc67fb2fd5d9bb4319a956097f9c1 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 15 Nov 2025 00:19:32 +0800 Subject: add more tests --- xmake/core/base/xml.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'xmake/core/base/xml.lua') 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 -- cgit v1.3.1