Problem with "&" charater in xml.

Stefan Behnel stefan.behnel-n05pAM at web.de
Mon Jul 17 06:15:40 EDT 2006


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
> <Directory>
>   <dirname>C:\Documents and Settings\Administrator\Desktop\1\bye
> w&y </dirname>
> [...]
> #-----------------------------------------------------------------------------
> i run the code as:  $python art.py test1.xml
> 
> i am getting output as:
> 
> C:\Documents and Settings\Administrator\Desktop\1\bye w
> &
> y
> C:\Documents and Settings\Administrator\Desktop\1\hii wx
> 
> where as i need an output which should look like this.
> C:\Documents and Settings\Administrator\Desktop\1\bye w&y
> 
> C:\Documents and Settings\Administrator\Desktop\1\hii wx

This SAX filter is another way of doing it:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/265881

Stefan



More information about the Python-list mailing list