From anonymous, 5 Years ago, written in Python.
This paste is a reply to etree from The Compiler
- view diff
Embed
  1. xpath = "/EtherCATInfo/Descriptions/Devices/Device[1]/Profile[1]/Dictionary"
  2.  
  3. oldtree = etree.parse(filename)
  4. root = oldtree.getroot()
  5. oldnode = root.xpath(xpath)[0]
  6.  
  7. root.replace(oldnode, newnode)