I am using sharepoint 2013. I have used the xml viewer webpart but I have to much trouble and limitations. I would like to build a visual webpart in Visual Studio. In this webpart I would like to read an xml file from url. And use my own xsl 2.0 . How can I do this?
Here are some links to create visual web part in visual studio :
There are multiple methods to capture XML from a URL, but this particular example is helpful when you are dealing with special characters of foreign languages. The loaded XML will display them in correct format for the charset specified.
//Include the following packages using System.Net; using System.IO; //request the particular web page HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://feeds.feedburner.com/pointsharepoint?format=xml"); //define the login credentials of the requested file/page request.Credentials = new NetworkCredential(”UserName”, “Password”); //get the response from the request HttpWebResponse response = (HttpWebResponse)request.GetResponse(); //create a stream to hold the contents of the response Stream receiveStream = response.GetResponseStream(); //create your XML document XmlDocument mySourceDoc = new XmlDocument(); //load the file from the stream mySourceDoc.Load(receiveStream); //close the stream receiveStream.Close()