How to transform an xml structure generated from a

2019-05-17 01:28发布

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条回答
兄弟一词,经得起流年.
2楼-- · 2019-05-17 02:25

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.

查看更多
登录 后发表回答