On Aug 17, 8:31 pm, John Posner <jjpos...@optimum.net> wrote:
> > Use the iterparse() function of the xml.etree.ElementTree package.
>
> >http://effbot.org/zone/element-iterparse.htm
> >http://codespeak.net/lxml/parsing.html#iterparse-and-iterwalk
>
> > Stefan
>
> iterparse() is too big a hammer for this purpose, IMO. How about this:
>
>   from xml.etree.ElementTree import ElementTree
>   tree = ElementTree(None, "myfile.xml")
>   for elem in tree.findall('//book/title'):
>       print elem.text
>
> -John

Thanks for the prompt reply .

I feel let me try using iterparse. Will it be slower compared to SAX
parsing ... ultimately I will have a huge xml file to parse ?


Another question , I will also need to validate my xml against xsd . I
would like to do this validation through the parsing tool  itself .

Does there exist an Unix utility which validates or even a python
library call would be fine  ?

Thanks in advance
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to