I would suggest that you start with Python's own xml.etree:

import xml.etree.cElementTree as ET
tree = ET.ElementTree(file='document.xml')
root = tree.getroot()
for child in root:
    print(child.tag, child.attrib)



On Tuesday, September 17, 2013 12:45:22 PM UTC+1, Nathann Cohen wrote:
>
> Helloooooooo everybody !
>
> We have in Sage an interface with ISGCI [1], and most of the code it 
> contains amounts to parsing a xml file, i.e. the db it gives access to. The 
> code is (very) ugly, and a friend of mine told me that I should use some 
> Python library to "objectify" this XML file, so that we only need work with 
> dictionaries (and not with the XML file) in the code.
>
> It looks like lxml would do the job, and there are others like gnosis or 
> amara that seem to do the same kind of things.
>
> Did you ever use any of those, and would you think it a good idea to add 
> them into Sage ? It would definitely simplify this code, at least.. :-)
>
> By the way, this interface is being patched by #14396, and it would be 
> great if somebody was willing to give it a review... The db's author has 
> been very kind with us, and the improvements I promised him are not 
> available in Sage yet ^^;
>
> Have fuuuuuuuuuuuuuuuuuuuuuuuuuuuuun :-)
>
> Nathann
>
> [1] http://graphclasses.org/
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to