One solution might be to implement IXmlSerializable interface on your class. I'm not sure if the XmlWriter will allow you to write a XML tag or not. http://stackoverflow.com/questions/279534/proper-way-to-implement-ixmlserializable
A:
Erik Philips
2010-07-29 21:34:23
Thanks for the suggestion but I think I found and easier way to deal with the problem.Tony
tony
2010-07-30 14:12:18
Can you post what your answer was and mark it as the answer? I'm interested in what you came up with.
Erik Philips
2010-07-30 17:52:30
A:
Hello, I haven't found an easy way to customize the stylesheet or the encoding line but I found a good suggestion here:
The idea is to pretty much write your own serialization class. I took the idea from the article and I created a class that serializes the class (using the C# library) then a filter modifies the header to modify the encoding line and add the stylesheet line.
When I load the xml, I read the file, I pass it through the filter to remove the stylesheet line and I change back the encoding line. Once I have done that, I use the de-serializer provided by C#.
It seems to work.
Tony
tony
2010-07-30 13:35:42