celementtree

Find all nodes from an XML using cElementTree

Is there a way to find all nodes in a xml tree using cElementTree? The findall method works only for specified tags. ...

How to retrieve the parent node using cElementTree?

for the xml <grandparent> <parent1> <child>data1</child> </parent1> <parent2> <child>data2</child> </parent2> </grandparent> I need the list containing tuples of parent,data for each parent in xml. Is there a way to do it USING cElementTree? I am able to do it for child,data, but unfortunately child is identical in...

Django soaplib error

Hi, I'm trying to make a little "Hello World" webservice with Django following a few tutorials, but I'm hitting the same barrier over and over. I've defined a view.py and soaplib_handler.py: view.py: from soaplib_handler import DjangoSoapApp, soapmethod, soap_types class HelloWorldService(DjangoSoapApp): __tns__ = 'http://saers.d...

parsing XML file in python with cElementTree: dealing with errors and line number in the file

Hello I am using the cElementTree library to parse XML files in Python. Everything is working fine But I would like to provide full error messages for the user when a value in the XML is not correct. For example, let's suppose I have the following XML: <A name="xxxx" href="yyyy"/> and want to tell the user if the href attribute doe...

Which Python XML library should I use?

Hello. I am going to handle XML files for a project. I had earlier decided to use lxml but after reading the requirements, I think ElemenTree would be better for my purpose. The XML files that have to be processed are: Small in size. Typically < 10 KB. No namespaces. Simple XML structure. Given the small XML size, memory is not...

Parsing XML using xml.etree.cElementTree

I have the following XML in a string named 'xml': <?xml version="1.0" encoding="ISO-8859-1"?> <Book> <Page> <Text>Blah</Text> </Page> </Book> I'm trying to get the value Blah out of it but I'm having trouble with xml.etree.cElementTree. I've tried the find() and findtext() methods but nothing. Eventually I did this: import xm...