Friday, June 4, 2010

Serialize with Stylesheet

Copied from http://stackoverflow.com/questions/1461029/possible-to-add-a-xslt-stylesheet-to-a-serialized-xml-document

XmlSerializer s = new XmlSerializer(typeof(myObj));


using (XmlWriter w = XmlWriter.Create(@"c:\test.xml"))

{

w.WriteProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"USED-FILE.xsl\"");

s.Serialize(w, myObj);

}

No comments:

Post a Comment