gpt4 book ai didi

c# - 如何将从请求生成的 xml 结构转换为 Web 服务

转载 作者:数据小太阳 更新时间:2023-10-29 02:45:24 24 4
gpt4 key购买 nike

我有一个字符串变量,用于存储从请求到 RESTful 服务的 xml。

我在不保存的情况下使用 xslt 文件快速转换它时遇到问题。

我收到这个错误

System.UriFormatException: Invalid URI: The Uri scheme is too long. 在这一行

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?

上面链接中的想法有助于通过在转换之前将字符串传递给 XmlReader 来解决这个问题。

关于c# - 如何将从请求生成的 xml 结构转换为 Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19790515/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com