convert XML to HTML
-
Hello I need to convert an XML doc (which has an XSL applied to it) to an HTML doc. I tried this, but it does not allow me to specify a URL as a path:
//1) Load the Xml document XPathDocument myXPathDoc = new XPathDocument("C:\\SSW55P12902365.XML"); //2) Load the Xsl file XslCompiledTransform myXslTrans = new XslCompiledTransform(); //XslTransform myXslTrans = new XslTransform(); myXslTrans.Load("C:\\Style.xsl"); //3) Create a stream for output XmlTextWriter myWriter = new XmlTextWriter("http://www.SpecifiedURL/SSW55P12902365.html", null); //4) Perform the actual transformation myXslTrans.Transform(myXPathDoc,null,myWriter);
If I use a folder path on the hard drive instead of the URL it works. Is there any other (free) way to do this conversion? Thanks M -
Hello I need to convert an XML doc (which has an XSL applied to it) to an HTML doc. I tried this, but it does not allow me to specify a URL as a path:
//1) Load the Xml document XPathDocument myXPathDoc = new XPathDocument("C:\\SSW55P12902365.XML"); //2) Load the Xsl file XslCompiledTransform myXslTrans = new XslCompiledTransform(); //XslTransform myXslTrans = new XslTransform(); myXslTrans.Load("C:\\Style.xsl"); //3) Create a stream for output XmlTextWriter myWriter = new XmlTextWriter("http://www.SpecifiedURL/SSW55P12902365.html", null); //4) Perform the actual transformation myXslTrans.Transform(myXPathDoc,null,myWriter);
If I use a folder path on the hard drive instead of the URL it works. Is there any other (free) way to do this conversion? Thanks Mthe dirty way :
string xmldata = new Webclient().DownloadString("http://your.desired.url/file.xml"); XPathDocument myXPathDoc = new XPathDocument(xmldata);
... //go on with your stuff. maybe you want to structure it, add exception handling or use it in an async manner, but it´s probably the right direction if you want to use a url instead of a local file.