[XML-SIG] ampersand in name how to parse

Hirendra Hindocha hiren@infoseek.com
Mon, 25 Jan 1999 20:42:59 -0800 (PST)


Hi,

I've just started working with the xml package and I was 
trying to parse a document which looks like this - 

<node name="root" id="">
 <node name="test & 2" id="1234">
 </node>
 </node>

the & in the name above seems to cause an exception .

I have the following code fragment - 
class TaxonomyHandler(saxlib.DocumentHandler):
    def startElement(self, name, attrs):
		nodename = attrs['name']
		id = attrs['id']
		print nodename,id

If I use the BaseHandler to inherit from , the second node is silently
ignored. When I use the DocumentHandler as above, an exception is
generated.  If I drop the "&" then everything works. 

What do I need to do to be able to accept the & in the name ? 

Any help is appreciated,
Thanks,
Hiren
--------------------------------------------------------
USER ERROR: replace user and press any key to continue.