Python 3.x 如何在xml树中循环时更新direct children元素?

Python 3.x 如何在xml树中循环时更新direct children元素?,python-3.x,lxml,elementtree,python-xmlschema,Python 3.x,Lxml,Elementtree,Python Xmlschema,我试图根据绝对路径从xml树中查找所有直接子元素 由于机密,我无法附加xml full_entry_point=".//Home/sub/Entry/accessory/Entry" default_entry=".//Home/sub/Entry" 我在下面的for循环中尝试迭代“default_entry”,一旦我获取了标记,我需要根据条件将迭代切换到循环中的full_entry_点 status = False for entry in tree

我试图根据绝对路径从xml树中查找所有直接子元素

由于机密,我无法附加xml

full_entry_point=".//Home/sub/Entry/accessory/Entry"

default_entry=".//Home/sub/Entry"
我在下面的for循环中尝试迭代“default_entry”,一旦我获取了标记,我需要根据条件将迭代切换到循环中的full_entry_点

status = False
for entry in tree.findall(default_entry.lower()):
   path="somepath"
  find_result = entry.find(path).text()
  if status== True:
      """
      Here i need to change the iteration value of 'entry' from 'default_entry' to 'full_entry_point'
      like 
      entry should point to 'tree.findall(full_entry_point.lower())'
      that mean it should fetch direct child element of 'full_entry_point'
      """
请让我知道如何才能达到同样的效果


谢谢

可以发布一个非常简化的XML版本以及您想要的输出吗?