Hello Giuseppe,

thanks again. Worked fine. In case someone has the same problem, here is
how I strip out the whitespace with Apache Ant:

<target name="remove-space" depends="xinclude">
<replaceregexp flags="g">
<regexp pattern="(&gt;)(\s+)([\.,])" />
<substitution expression="\1\3" />
<fileset dir="${outputtmp.dir}/">
<include name="**/*" />
</fileset>
</replaceregexp>
<replaceregexp flags="g">
<regexp pattern="(\w)(\s+)(&lt;/)" />
<substitution expression="\1\3" />
<fileset dir="${outputtmp.dir}/">
<include name="**/*" />
</fileset>
</replaceregexp>
</target>

Best regards, Lars

2011/11/11 Lars Vogel <lars.vo...@googlemail.com>

> Hi Giueseppe,
>
> thanks for the answer. I like proposal number 2.) which seems most
> practical to me.
>
> Also I didn't know that  oxygen is Eclipse tooling. I need to look at it.
>
> Thanks again, Lars
>
>
> 2011/11/11 Giuseppe Bonelli <peppo.bone...@gmail.com>
>
>> Hi Lars,
>> what you describe happens often, depending on the pretty print
>> algorithm used by the xml editor.
>>
>> I think you have three options:
>> 1. if you can use xslt2.0, you can have regular expressions during the
>> transformation
>> 2. you can use a regex on the whole xml file treated as a string
>> 3 you can use an xml editor with a smarter pretty print algorithm. I
>> personally use the oxygen eclipse plugin, but this is not free. When
>> you format the xml using oxygen the spaces in mixed content nodes is
>> preserved (I have just made a simple test on your example and no space
>> before the period is inserted after formatting the source).
>>
>> Hope this helps.
>>
>> __peppo
>>
>> On Fri, Nov 11, 2011 at 11:19 AM, Lars Vogel <lars.vo...@googlemail.com>
>> wrote:
>> > Hello,
>> > I use Eclipse as my XML editor and this really works well for me except
>> one
>> > thing. Unfortunately the XML formatter in Eclipse adds a space between a
>> > closing tag and a dot. If its not a dot I actually would like that it
>> adds
>> > this space.
>> > Example:
>> > Call method <code>test()</code>.
>> > Would become>
>> > Call method  <code>test()</code> .[Space after</code>]
>> > Is there a way to tell the XSLT conversion to remove spaces between
>> closing
>> > XML tags and dots? If yes, it would be great to get some pointers how to
>> > implement this.
>> > Best regards, Lars
>> > --
>> > Lars
>> > http://www.vogella.de - Eclipse, Android and Java Tutorials
>> > http://www.twitter.com/vogella - Lars on Twitter
>> >
>>
>
>
>
> --
> Lars
> http://www.vogella.de - Eclipse, Android and Java Tutorials
> http://www.twitter.com/vogella - Lars on Twitter
>



-- 
Lars
http://www.vogella.de - Eclipse, Android and Java Tutorials
http://www.twitter.com/vogella - Lars on Twitter

Reply via email to