Kirt wrote:
> i have walked a directory and have written the foll xml document.
> one of the folder had "&" character so i replaced it by "&"
> #--test1.xml
>
> C:\Documents and Settings\Administrator\Desktop\1\bye
> w&y
> [...]
> #---
Note that any good SAX tutorial will demonstrate how to buffer the
characters() events, if you don't feel like reinventing the solution
yourself.
--
http://mail.python.org/mailman/listinfo/python-list
A SAX parser can notify a text node by calling any number of times the
characters method so you need to accumulate all the information you
receive on the characters method and output the text when you get a
notification different than characters.
Best Regards,
George
--
thanx stefan ur approach worked.
Stefan Behnel wrote:
> Kirt wrote:
> > How do i append characters to a string?
>
> I think the normal approach is to store an empty string (or list) in an
> attribute in startElement(), append to it in characters() and use the result
> in endElement().
>
> def star
Kirt wrote:
> How do i append characters to a string?
I think the normal approach is to store an empty string (or list) in an
attribute in startElement(), append to it in characters() and use the result
in endElement().
def startElement(self, ...):
self.chars = ''
def characters(self, s):
How do i append characters to a string?
actually my entire handler code is
class oldHandler(ContentHandler):
def __init__(self):
self.fn = 0
self.dn = 0
self.i=[]
self.x=""
Kirt wrote:
> i have walked a directory and have written the foll xml document.
> one of the folder had "&" character so i replaced it by "&"
> #--test1.xml
>
> C:\Documents and Settings\Administrator\Desktop\1\bye
> w&y
>
> def.txt
> 200607130417
>
>
>
> C:\Docum
i have walked a directory and have written the foll xml document.
one of the folder had "&" character so i replaced it by "&"
#--test1.xml
C:\Documents and Settings\Administrator\Desktop\1\bye
w&y
def.txt
200607130417
C:\Documents and Settings\Administrator\Deskt