Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Question Marks (???) in out put HTMl

From: Zest4Quest@-----------.---------.---
To: 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/
> 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent