问题标签 [selectsinglenode]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - SelectSingleNode,如何使用字符串变量编写 xpath 查询?
您好我有使用不同命名空间的 xml 文件(实际上是 msbuild 文件)
我试图获得“钥匙”的价值。但问题是子节点(键)是在 c# 代码中动态决定的。所以我不能只将 childname 附加到 xpath 查询。但我有一个具有子节点名称的字符串变量
那么,在获得正确的属性组之后,我应该如何编写 xpath 查询才能获得正确的值?
c# - Html Agility Pack SelectSingleNode 在迭代中总是给出相同的结果?
我想要集合中的节点,但是通过迭代 SelectSingleNode 我不断得到相同的对象,只是 node.Id 正在改变......我尝试的是读出给定站点的 webresponse 并捕获一些信息,如值、链接......特殊定义的元素。
这是例如 1 次迭代:
javascript - 在 Internet Explorer 10 中使用 Javascript 加载 XML 文件不起作用
我正在使用下面的代码使用 javascript 加载 XML 文件。我遇到的问题是单独使用 Internet Explorer 10,它可以在其他所有浏览器中运行。
经过一些研究,我非常有信心这是 IE10 放弃了“selectSingleNode”兼容性的事实,但我就是想不出一个解决办法。关于如何在 IE10 中工作的任何提示?谢谢。
c# - 使用 XPath 选择 XML 节点
我有一个 xml,我想从中选择一个节点,这里是 xml:
我正在使用XmlDocument
's加载它LoadXML
并尝试获取InResult
节点,但我得到 null 请参见下文:
c# - Editing an XML file in C#; SelectSingleNode returns null
I'm trying to find existing content within an XML file and change it by making use of the SelectSingleNode command. However, all I get is a NullReferenceException. Maybe I'm just not getting how the file path works with this particular command, but I've tried many variants I've found online but to no avail. Could anyone help me figure out what I'm doing wrong?
Here's the script.
And here's a sample of my XML file.
c# - foreach xmlnode selectsinglenode在c#中无法正常工作
我正在尝试创建一个列表,其中列表中的每个项目都包含包的名称和保存位置。我创建了一个具有两个变量名称和位置的构造函数。然后我创建了一个包含该构造函数的列表。我能够抓住这个名字,但这个位置给我带来了一些麻烦。此外,如果节点没有位置,那么我想要列表中该项目的空字符串。[请参阅我想要澄清的结果列表]。
我的 XML:
我的 C# 代码:构造函数:
其余代码:
有人可以帮我吗?是 xpath 还是代码本身的问题?非常感谢!
c# - 将 SelectSingleNode 与 XPath 一起使用会返回 NULL
我试图用SelectSingleNode
. 文件的结构是
我在 VS C# 上的代码是
所以,我试图用 修改标签VersionInfo
,Name="Build"
但SelectSingleNode
返回NULL
。我做错了什么?
c# - XML selectsinglenode how i filter tag?
I'm starting to program in C # and i am beginner, so i don't have experience. I want to one day be a professional and started to develop solutions. My program save the information in xml file and then read the same information in same xml. The xml file has this format
And in C# code my solution has:
How can I filter the content of the xml file, especially the tag . I need that my solution read the xml file and when he read the tag he should be able to say through Messagebox "Error tag is not equal to ", otherwise if tag equals to he must to continue
powershell - .SelectSingleNode 在 Powershell 脚本中使用 xPath 无法从 web.config 文件中提取值
好的,这是我的 web.config 文件的片段:
我要做的是通过 Powershell 使用 xPath 找到节点。关于这个 XML 文件有几点需要注意:
有多个:
xml 文件中的值。它们围绕其他节点,例如等...
我可以使用此脚本成功找到并替换连接字符串值
但是当我去使用这个脚本替换 add key="SiteDomain" 值时:
这没用。在这种情况下,$node 值包含一个空字符串。
我也试图像这样读取节点:
而且我仍然得到 $existingSiteDomain 值的空字符串。
我已经使用 SelectSingleNode 查看了示例,但我似乎不太明白。不太确定我做错了什么。
谢谢,迈克
c# - 当我在 XPathNodeIterator.Current.SelectSingleNode 下搜索时,它只是在整个 xml 文档中搜索
您好我正在使用 XPathNodeIterator 在 XML 文档下的 XML 节点列表中进行迭代。如果条件匹配,则在迭代时,我需要该当前节点下的特定值。相反,SelectSingleNode 正在从其他父节点返回节点......让我举个例子:
示例 xml:
假设,我正在迭代所有“元素”并试图找到元素 id=2 的“地址”。现在,在迭代时假设我在“Element id=2”。当我找到节点时,我会说从当前节点 (nodeIterator.Current) 中选择一个名为“Zip”的节点。为此,我将 xpath 用作“/Address/ZipCode”(此处的格式可能是错误的,因为这只是示例)。在这种情况下,它应该返回 null,而是从“Element id=1”返回 ZipCode
任何帮助将是可观的..