XML Formatting and CDATA

XML Formatting and CDATA

1
NewbieNewbie
1

    Aug 23, 2010#1

    Hello all,

    I've checked the forums and I don't really see an answer to my question so here goes...

    I've got a ton of XML files that contain, among a bunch of other things, CDATA elements... I would like to find a way to be able to use the Format -> XML Convert to CR/LFs feature of Ultra-Edit to clean up the XML without affecting the text inside the CDATA sections. These CDATA sections contain pre-formatted text that needs to stay in the format that it is in so when I use the XML Convert functionality it always pushes all the CDATA text back to character position 0 so I always have to go back through the CDATA to put it back right. Is there a way to configure XML Convert to ignore the CDATA sections when reformatting the XML?

    I'm running UEStudio v10.10.0.1012

    Thank you!

    6,681583
    Grand MasterGrand Master
    6,681583

      Aug 24, 2010#2

      There are no options for ignoring sections when using command XML Convert to CR/LFs.

      You can only write a script or macro which protects the format of such a section for example by replacing every space inside such a section by a non breaking space (decimal code 160, hexadecimal code A0), every line termination inside such a section by another special character like the paragraph character (decimal code 182, hex. B6), and every tab character for example by the character with decimal code 187 which results in converting those sections into single line with no whitespace characters inside. After executing XML Convert to CR/LFs also from within the macro/script, the macro/script replaces the non breaking spaces back to normal spaces, the paragraph characters back to line terminations and the » characters back to tabs.

      It is not really difficult to code this with a macro or script. I just can't do that now because I don't have input examples for the macro/script. Of course that method with converting a CDATA section temporarily into a non-breakable single line string could fail when such CDATA sections have in total more than 20.000 characters. However, also in this case I would have already an idea how to solve this, but if that idea works depends on the sources which I don't have.
      Best regards from an UC/UE/UES for Windows user from Austria