问题
I have a string var that store an xml from a request to a RESTful service.
I have a problem transforming this with an xslt file on a fly without saving it.
I am getting this error
System.UriFormatException: Invalid URI: The Uri scheme is too long.
On this line
xslt.Transform(xmldoc, null, writer);
string xmldoc = xReq("http://restful.com/RestAPI");
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(@"C:\Users\XSeXml\xRes.xslt");
string htmlOutput;
StringWriter writer = new StringWriter();
xslt.Transform(xmldoc, null, writer);
htmlOutput = writer.ToString();
Literal1.Text = htmlOutput;
writer.Close();
回答1:
How to transform XML as a string w/o using files in .NET?
Ideas from the link above helps to overcome the problem by passing the string to the XmlReader before transforming it.
来源:https://stackoverflow.com/questions/19790515/how-to-transform-an-xml-structure-generated-from-a-request-to-a-web-services