strip spaces before writing the files

Without stripping the spaces tools/validate.py will not accept
the generated XML files.

Change-Id: I67d58cdf602107be05c6152eb59e4c12a2c0afd4
Merge "strip spaces before writing the files"