1

Is it possible to force the XmlSerializer to serialize a class like the following:

public class Dummy
{
    public string SomeString = " hello world ";
}

in something like this:

<?xml version="1.0" encoding="utf-8" ?>
<Dummy>
  <SomeString>&#x0020;hello&#x0020;world&#x0020;</SomeString>
</Dummy>

EDIT

in other words I need to preserve all whitespace in the original string, otherwise how can I tell if a document like this:

<?xml version="1.0" encoding="utf-8" ?>
<Dummy>
  <SomeString>
     hello world</SomeString>
</Dummy>

contains the original whitespace before the word "hello"?

sblandin
  • 904
  • 4
  • 11
  • 25

0 Answers0