all groups > dotnet xml > august 2005 >
You're in the

dotnet xml

group:

URI formats are not supported



URI formats are not supported K riley
8/23/2005 11:44:59 AM
dotnet xml: Hi.

I am trying to use the XslTranfrom object and I am getting an unhandled
expection.
URI formats are not supported
Exception Details: System.ArgumentException: URI formats are not supported.

I am following the example as layed out by Microsoft for C#
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxslxsltransformclasstransformtopic16.asp

From the error stack I believe the error is occurring when I try to
create the FileStream
FileStream fs = new
FileStream("http://localhost/MyWebApplication/cust.html", FileMode.Create);

I checked permissions on my web server and have given the iusr account
the ability to create/delete/edit files. I did this thinking it was a
permissions

Thanks in advance for any help.

My Code
.....

XmlTextReader xtr = new
XmlTextReader("http://localhost/MyWebApplication/asucPartial.xml");
xtr.WhitespaceHandling = WhitespaceHandling.None;

XmlDocument xd = new XmlDocument();
xd.Load(xtr);

XslTransform xslt = new XslTransform();
xslt.Load("http://localhost/MyWebApplication/ASUC1.xsl");


//From Microsoft
// Create an XPathNavigator to use in the transform.
XPathNavigator nav = xd.CreateNavigator();

// Create a FileStream object.
//FileStream fs = new
FileStream("http://localhost/MyWebApplication/cust.html", FileMode.Create);

FileStream fs = new
FileStream("http://localhost/MyWebApplication/cust.html",
FileMode.CreateNew);

// Transform the data.
xslt.Transform(nav, null, fs, null);
Re: URI formats are not supported Chris Lovett
8/23/2005 2:23:03 PM
FileStream is just for local files. Use System.Net.WebRequest instead.

[quoted text, click to view]

Re: URI formats are not supported K riley
8/24/2005 9:37:06 AM

Thank you.

What I ended up doing is using the Revolver to accomplish my task

// Create a resolver with default credentials.
XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the XslTransform object.
XslTransform xslt = new XslTransform();

// Load the stylesheet.
xslt.Load("http://localhost/MyWebApplication/file.xsl", resolver);

// Transform the file.
xslt.Transform(Server.MapPath("xmlfile.xml"),
Server.MapPath("xmltohtml.html"), resolver);

[quoted text, click to view]
AddThis Social Bookmark Button