[egenix-users] mxTidy: CDATA being indented
M.-A. Lemburg
mal at lemburg.com
Mon Jun 30 17:06:56 CEST 2003
William Trenker wrote:
> Hello,
>
> I'm trying out mxTidy to provide transparent clean-up for xml files.
> Included in my xml are elements containing restrucured text. To
> perserve the line-breaks and indentations, which are significant in
> restructured text, I am using CDATA.
>
> I'm having difficulty figuring out which combination of options to give
> to mxTidy so that the CDATA sections won't get indented. I've attached
> a simply pyton script below to clarify my attempts.
You should switch off indenting: indent="no"
> Thanks for any insight you can pass along.
>
> Regard,
> Bill
>
> -----------------script----------------------
>
> import mx.Tidy as tidy
>
> xml = '''
> <section>
> <rstx>
> <![CDATA[
> Here is a title
> ---------------
> Here is a paragraph
> Here's a second paragraph.
> * A List; item 1
> * item 2
> * item 3
> ]]>
> </rstx>
> </section>
> '''
>
> tidied = tidy.tidy(xml,
> input_xml=1,
> indent_spaces=4,
> wrap=0,
> wrap_sections=0,
> output_xml=1,
> indent='auto'
> )[2]
>
> print tidied
>
> --------------output--------------------
>
> <section>
> <rstx>
> <![CDATA[
> Here is a title
> ---------------
> Here is a paragraph
> Here's a second paragraph.
> * A List; item 1
> * item 2
> * item 3
> ]]>
> </rstx>
> </section>
>
--
Marc-Andre Lemburg
eGenix.com
Professional Python Software directly from the Source (#1, Jun 30 2003)
>>> Python/Zope Products & Consulting ... http://www.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
More information about the egenix-users
mailing list