[Zope] removing newline character from returned python string

Jon Erickson jon.erickson@neicoltech.org
21 Jun 2002 14:44:36 -0500


Thanks for the reply... this actually turned out to be a different
problem altogether.  I had suspected at first that the newline character
was causing invalid xml but it seems to be something else.  Sorry for
bothering everyone during my "learning xml" phase ;-)

Jon

On Fri, 2002-06-21 at 14:20, Andreas Jung wrote:
> .strip() only removes leading and trailing whitespaces.
> To remove '\n' within the document you should something like
> XML=XML.replace('\n','').
> 
> -aj
> 
> 
> --On Friday, June 21, 2002 13:33 -0500 Jon Erickson 
><jon.erickson@neicoltech.org> wrote:
> 
>> I have a python script that transforms the results of a zsql method
into
>> xml.  The script builds the xml in a python string and returns that
>> string as the scripts output.  The problem I have is that the string
>> contains a newline character (\n) which corrupts the xml.  I made
sure
>> to strip the string before it's returned...
>>
>> XML = XML.strip()
>> return XML
>>
>>... but the output always contains the newline character.  Does anyone
>> have suggestions on how I could fix this?
>>
>> Thanks,
>>
>> Jon
>>
>>
>>
>>
>> _______________________________________________
>> Zope maillist  -  Zope@zope.org
>> http://lists.zope.org/mailman/listinfo/zope
>> **   No cross posts or HTML encoding!  **
>> (Related lists -
>>  http://lists.zope.org/mailman/listinfo/zope-announce
>>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
> 
> 
> 
> 
>
---------------------------------------------------------------------
>    -    Andreas Jung                     http://www.andreas-jung.com
-
>   -   EMail: andreas at andreas-jung.com
-
>    -            "Life is too short to (re)write parsers"
-
>
---------------------------------------------------------------------
> 
>