【发布时间】:2022-11-04 19:53:08
【问题描述】:
我正在学习 azure 函数作为其中的一部分,我想将相同 xml 结构的两个不同 xml 文件合并到一个 xml 文件中。有人可以帮助我如何使用 azure 函数来做到这一点吗?
通过异步方法合并 xml 时,我无法使用 XmlDocument.Open 打开 xmldocument,因为没有为 XmlDocument 打开定义。我们如何打开 xmldocument 数据?
这是我的代码,我在通过 memorystream 打开 xmldocument 时卡住了
private async Task<IList> MergeFileAsync(CloudBlobContainer container, string[] blobFiles)
{
XmlDocument outputDocument = new XmlDocument();
foreach(String fileblob in blobFiles)
{
string file = $"" + blobFiles;
CloudBlockBlob blockBlob = container.GetBlockBlobReference(file);
using(var memoryStream = new MemoryStream())
{
await blockBlob.DownloadToStreamAsync(memoryStream);
string contents = blockBlob.DownloadTextAsync().Result;
//stuck here
var inputDocument = XmlDocument.Open(memoryStream, XmlDocument.Import);
}
}
}
【问题讨论】:
-
请说明您遇到了什么错误以及您在哪条线路上遇到了问题。
-
嗨,我在 var inputDocument = XmlDocument.Open(memoryStream, XmlDocument.Import); 行收到错误错误说 theta XmlDocument 不包含 Open 的定义我正在使用与 pdf 合并类似的定义,所以我也尝试将其用于 xml 合并,但出现上述错误。所以请帮助我如何前进从这里或者是否有任何替代我可以工作的地方....谢谢
-
您可以使用您在评论中提供的信息更新问题吗?因为你的问题不符合社区标准。除非它被更新,否则它将被关闭。
标签: c# azure azure-functions concatenation azure-storage