[egenix-users] mxTidy: CDATA being indented

William Trenker wdtrenker at yahoo.ca
Tue Jun 24 17:46:53 CEST 2003


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.

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>

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


More information about the egenix-users mailing list