Parsing XML with Rhino Python issues

Hi All,

I am writing a script that runs in rhino and opens an xml file. I am using the instructions from IronPython’s documentation. However, I keep getting an error that looks like it relates to the libraries.

import rhinoscriptsyntax as rs
from xml.etree.ElementTree import ElementTree

def SortByName():
#load the xml file
tree = ElementTree()
tree.parse(‘C:\Users\jikatz\Desktop\sort_schema.xml’)

Message: No module named expat; use SimpleXMLTreeBuilder instead

Traceback:
line 1445, in init, "c:\Program Files\Rhinoceros 5 (64-bit)\Plug-ins\IronPython\Lib\xml\etree\ElementTree.py"
line 648, in parse, "c:\Program Files\Rhinoceros 5 (64-bit)\Plug-ins\IronPython\Lib\xml\etree\ElementTree.py"
line 7, in SortByName, "C:\Users\jikatz\Desktop\SortByName.py"
line 25, in , “C:\Users\jikatz\Desktop\SortByName.py

Any help you can give me would be greatly appreciated.

Hi Joshua,

you might try to use System.Xml instead as described here for reading and saving xml files.

c.