View Full Version : XML Element content with trailing spaces

02-29-2008, 05:10 PM
I am seeing this issue with IS 2008 Premier and Basic MSI project.

If you try and write a string to an XML Element that contains a trailing space, after you view the XML file, the string does not contain the trailing space. Steps to reproduce:
- Create a sample Basic MSI install
- Choose XML File Changes view and create a new xml file to install/uninstall, UTF-8
- Create a new root element called "Test" without quotes
- In Advanced tab of element, Check Always create..., Remove Element... and Set Content
- For the string content, enter "Test Value " without quotes, but note the trailing space
- Build the release and install
- Got to install dir and look at content of XML file
- Value reads: <Test>Test Value</Test>
- Trailing space is not there
- Note: If you enter " Test Value " for the string content, the xml file will read: <Test> Test Value</Test>

I am working on a product that will set an XML element value based on the property of an edit box and if that valuue contains a space at the end, it needs to be reflected properly in teh XML file. I have tried changing the Encoding type to something other than UTF-8 with no luck.

Is there a way to get around this without having to write a custom action and manually edit the XML (a pain using C++).