How to get xml.etree.ElementTree not bomb on invalid characters in XML file ?

Terry Reedy tjreedy at udel.edu
Tue May 4 13:43:16 EDT 2010


On 5/4/2010 11:37 AM, Stefan Behnel wrote:
> Barak, Ron, 04.05.2010 16:11:

>> The XML file seems to be valid XML (all XML viewers I tried were able
>> to read it).

 From Internet Explorer:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error 
and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

An invalid character was found in text content. Error processing 
resource 'file:///C:/Documents and Settings...

      <m_detail>"BROLB21


> This is what xmllint gives me:
>
> -----------------------
> $ xmllint /home/sbehnel/tmp.xml
> tmp.xml:6: parser error : Char 0x0 out of allowed range
> <m_sanApiName1>"MainStorage_snap
> ^
> tmp.xml:6: parser error : Premature end of data in tag m_sanApiName1 line 6
> <m_sanApiName1>"MainStorage_snap
> ^
> tmp.xml:6: parser error : Premature end of data in tag DbHbaGroup line 5
> <m_sanApiName1>"MainStorage_snap
> ^
> tmp.xml:6: parser error : Premature end of data in tag database line 4
> <m_sanApiName1>"MainStorage_snap
> ^
> -----------------------
>
> The file contains 0-bytes - clearly not XML.

IE agrees.





More information about the Python-list mailing list