如何从一个请求产生一个XML结构进行改造,以Web服务 [英] How to transform an xml structure generated from a request to a web services

查看:178
本文介绍了如何从一个请求产生一个XML结构进行改造,以Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储来自于RESTful服务的请求的XML字符串变种。



我有没有节省了一只苍蝇使用XSLT文件转换这是一个问题。它



我收到此错误



System.UriFormatException:无效的URI: URI方案太长。在此行

  xslt.Transform(xmlDoc中,空,作家); 






 字符串xmlDoc中= xReq(http://restful.com/RestAPI); 

XslCompiledTransform XSLT =新XslCompiledTransform();

xslt.Load(@C:\Users\XSeXml\xRes.xslt);

串htmlOutput;

StringWriter的作家=新的StringWriter();

xslt.Transform(xmlDoc中,空,作家);

htmlOutput = writer.ToString();

Literal1.Text = htmlOutput;

writer.Close();


解决方案

如何将XML作为一个字符串的w / o在.NET中使用文件?



理念有助于传递字符串到的XmlReader转变之前克服的问题。


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(); 

解决方案

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.

这篇关于如何从一个请求产生一个XML结构进行改造,以Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆