elementtree and entities

2008-03-17 Thread rurpy
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

Re: elementtree and entities

2007-05-13 Thread Daniel Nogradi
> > 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

Re: elementtree and entities

2007-05-13 Thread Duncan Booth
"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

elementtree and entities

2007-05-13 Thread Daniel Nogradi
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