xmltools icon indicating copy to clipboard operation
xmltools copied to clipboard

Trim whitespace from TEXT nodes during pretty print

Open LetMeSleepAlready opened this issue 4 years ago • 1 comments

See discussion in #55

Trimming means the following: " this is a text " => "this is a text"

Complexities in child elements:

The only first text-child of a node can be left-trimmed and the only last text-child of a node can be right-trimmed.

I agree with the summary about line break addition, keeping in mind that CDATA behave like TEXT. This means that

<tag> <![CDATA[ x ]]> </tag> will output

<tag><![CDATA[ x ]]></tag> when "Trim text whitespace" is enabled, and

<tag> <![CDATA[ x ]]> </tag> when "Trim text whitespace" is disabled. The content of CDATA block keeps always untouched.

LetMeSleepAlready avatar Sep 02 '20 12:09 LetMeSleepAlready

But it then must take xml:space into account.

mikekaganski avatar Nov 05 '20 07:11 mikekaganski