基于YAML定义XML修改规则的遍历与路径解析问题求助
Let me walk through the main hurdles we're hitting with this approach:
The core idea is solid: using a YAML file to define the target values we need to update in an XML file. On paper, YAML's hierarchical structure should pair perfectly with XML's tree-like format—but turning this theory into working code has been surprisingly tough.
We’ve got some existing code that’s buggy, but it at least makes the end goal clear. Right now, two big issues are holding us back:
Leaf-level YAML traversal demands messy recursive logic
We can’t traverse the YAML file to extract full paths to each target node without writing convoluted recursive operations. This adds unnecessary complexity, and it’s easy to introduce bugs when dealing with nested arrays or nodes of varying depths.Formatted paths still don’t solve the XML update problem
Even after we format those YAML paths into the expected structure likeparent1[0].parent2[0].@description(built to target specific XML elements, array indices, and attributes), we’re stuck on how to actually use this path to modify the corresponding XML node. The syntax looks correct in theory, but bridging the gap between that string and actionable XML manipulation code is a major blocker.
内容的提问来源于stack exchange,提问作者OliverNZ

