Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Question Marks (???) in out put HTMl >Thread Next - Re: Question Marks (???) in out put HTMl Re: Question Marks (???) in out put HTMlTo: NULL Date: 3/6/2009 11:14:00 AM Hi Marin,
I have the following function in C# which transforms the XML.
The GenerateXML() returns a string that represents the xml...
public class XmlGenerator<T> where T : class
{
private T _dataContract;
public XmlGenerator(T dataContract)
{
_dataContract = dataContract;
}
/// <summary>
/// Generates the XML from the Object
/// </summary>
/// <returns></returns>
private string GenerateXml()
{
UnicodeEncoding uniEncoding = new UnicodeEncoding();
string buffer;
DataContractSerializer ser = new
DataContractSerializer(typeof(T));
StreamWriter stWriter = null;
MemoryStream memoryStream = new MemoryStream();
XmlTextWriter xmlWriter = new XmlTextWriter(memoryStream,
Encoding.Unicode);
stWriter = new StreamWriter(memoryStream);
ser.WriteObject(memoryStream, this._dataContract);
buffer = Encoding.ASCII.GetString(memoryStream.GetBuffer());
return
buffer.Replace(@"xmlns=""http://schemas.datacontract.org/2004/07/EDIM.DataContracts""", "");
}
public string TransformXmlFinal(string xSLTFileName)
{
XmlDataDocument d = new XmlDataDocument();
string sXML = this.GenerateXml();
d.LoadXml(this.GenerateXml());
XslCompiledTransform xslTransform = new XslCompiledTransform();
xslTransform.Load(xSLTFileName);
MemoryStream memoryStreamOutPut = new MemoryStream();
xslTransform.Transform(d, null, memoryStreamOutPut);
return Encoding.ASCII.GetString(memoryStreamOutPut.GetBuffer());
}
}
Thanks for your help
..
"Martin Honnen" wrote:
> Zest4Quest wrote:
>
> > Like i said i am new to xslt..Not sure what a processor is...I am
> > displaying the output html in a Microsoft Webbrowser control in a Windows
> > form(C#).I created the XSLT using the Vstudio -> Add new item -> xslt
> > got the xml by using DataContractSerializer class since the entity is a
> > DataContract object.
>
> How do you create the output HTML exactly? How do you load it in the
> WebBrowser control?
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
