从字符串填充的XDocument [英] Populate XDocument from String

查看:91
本文介绍了从字符串填充的XDocument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个小东西,我想弄清楚我是否可以从一个字符串加载一个XDocument。 XDocument.Load()似乎需要传递给它一个物理的XML文件的路径字符串。

I'm working on a little something and I am trying to figure out whether I can load an XDocument from a string. XDocument.Load() seems to take the string passed to it as a path to a physical XML file.

我想尝试绕过先创建物理的XML文件,并直接跳转到填充的XDocument的步骤。

I want to try and bypass the step of first having to create the physical XML file and jump straight to populating the XDocument.

任何想法?

推荐答案

您可以使用的 XDocument.Parse 这一点。

You can use XDocument.Parse for this.

这篇关于从字符串填充的XDocument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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