How to transform an xml structure generated from a request to a web services

筅森魡賤 提交于 2019-12-07 17:18:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!