I need to parse little snipits of xml that come from a file
that has a large DTD that defines hundreds or entities.
But when these snipits are parsed (with elementtree.XML())
without the DTD, the entities are undefined and cause a
parse failure.
Is there any way to tell elementtree to not fail on
> > How does one prevent elementtree converting & to & (and similarly
> > for other entities)?
> >
> from xml.etree import ElementTree as et
> x = et.Element( 'test' )
> x.text = '&'
> et.tostring( x )
> > '&'
> >
> > Sometimes I would like to have the output '&'
> >
>
> element
"Daniel Nogradi" <[EMAIL PROTECTED]> wrote:
> Hi list,
>
> How does one prevent elementtree converting & to & (and similarly
> for other entities)?
>
from xml.etree import ElementTree as et
x = et.Element( 'test' )
x.text = '&'
et.tostring( x )
> '&'
>
> Sometimes I would li
Hi list,
How does one prevent elementtree converting & to & (and similarly
for other entities)?
>>> from xml.etree import ElementTree as et
>>> x = et.Element( 'test' )
>>> x.text = '&'
>>> et.tostring( x )
'&'
Sometimes I would like to have the output '&'
Daniel
--
http://mail.python.org/mail