Ricardo Aráoz schrieb:
> Diez B. Roggisch wrote:
>> Ricardo Aráoz schrieb:
>>> Thanks Ivan, it seems a elegant API, and easy to use.
>>> I tried to play a little with it but unfortunately could not get it off
>>> the ground. I kept getting
>>>>>> root = et.fromstring(doc)
>>> Traceback (most recent call last):
>>>   File "<input>", line 1, in <module>
>>>   File "E:\Python25\lib\xml\etree\ElementTree.py", line 963, in XML
>>>     parser.feed(text)
>>>   File "E:\Python25\lib\xml\etree\ElementTree.py", line 1245, in feed
>>>     self._parser.Parse(data, 0)
>>> ExpatError: XML or text declaration not at start of entity: line 2, column 0
>> That's a problem in your XML not being XML. Has nothing to do with 
>> element-tree - as one sees from the error-message "ExpatError". If you 
>> show it to us, we might see why.
>>
> 
> Sure,
> 
> doc = """
> <?xml version="1.0"?>

It's not allowed to have a newline before the <?xml ...>

Put it on the line above, and things will work.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to