问题标签 [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.

0 投票
2 回答
1097 浏览

vb.net - vb.net XmlDocument.SelectSingleNode 和 xmlNamespace 问题

我试图让这段代码工作,但不知何故没有得到内容

我的代码

有人能帮助我吗?

0 投票
2 回答
118 浏览

c# - C#/Monogame - 从 XML 读取单个节点总是返回 NULL

目前我正在尝试从 XML 列表中随机选择一个名称并在控制台中打印它。但是,该节点似乎始终为空。我的 XML 看起来像这样:

和 C#:

在此先感谢您的帮助

0 投票
1 回答
1873 浏览

xml - 在 Powershell 脚本中使用 SelectSingleNode 提取值

我是 powershell 新手,正在尝试编写我的第一个脚本。请查看以下内容,看看您是否可以提供任何建议/

这是我的 TEST.text

这是 Powershell 脚本:

我的问题:有什么方法可以在 ONAME 为“O2”的 C 节点下仅选择 ANAME 为“A1”的单个节点?

0 投票
2 回答
4214 浏览

xml - Insert a new XML node after another node

I'm really struggling to manipulate some XML in PowerShell that I need to send back to a web service as a body. Could anyone help me get the XML laid out the way it needs to be please?

#xA;

needs to become:

#xA;

So far I've been able to create new XML Nodes/Elements for the new content, but I cannot get it to be inserted at the correct place. I can get the AppendChild() method to work, but it puts the content after the <UseForDefaultRoute> section - not before.

I've tried to do InsertBefore() and InsertAfter(), but it just doesn't want to work. Finally, when I do the AppendChild() approach, I also get a bit of extra text I wasn't expecting, something about xmlns?

#xA;

This is what I managed to put together, bear in mind that it's broken :(

#xA;

...following advice from Ansgar, this is my attempt at using a namespace. (broken)

#xA;
0 投票
1 回答
294 浏览

xpath - 根据标签的值选择SingleNode

此代码有效:

但我真正想要的本质上是:

desiredValue 不是属性,字符串变量将在使用之间发生变化。因此,如果我的标签是 FavoriteSteak,那么 XML 行将是:

...并且我希望 SelectSingleNode 调用返回一个等于“Ribeye”的 FavoriteSteak 实例。

如何编写过滤器?

0 投票
2 回答
282 浏览

xml - VBScript 中的 SingleSelectNode

我有节点<EnginesTimesQueues><NumberOfEngines>. 我需要将两个节点的值分别更新为 36 和 ABC。

我正在尝试使用以下节点遍历SingleSelectNode()节点:

最初在循环中将 EnginesTimesQueues 值更新为 36,第二次不是将 NumberOfEngines 更新为“ABC”,而是再次将 EnginesTimesQueues 更新为“ABC”。

0 投票
3 回答
200 浏览

xml - 从单个节点 xml 中获取值

我有这样的数据xml:

......

我只想提取值,其中 cle = SujetEmail。这意味着我想得到这个值:Compte rendu du défichage Préventel XXXXXXXX

我努力了 :

获取 cle 的值。这是工作。

但是当我像这样修改以获取 valeur 的值时:

我得到了空

我也试过这样:

有空..请帮帮我。

0 投票
1 回答
143 浏览

c# - 选择 XML 节点

我正在做一些非常简单的事情。我正在尝试从一个小的 XML 文件中检索一个节点。

我正在尝试获取 ServiceProvider。以下是我拥有的 C# 代码:

字符串父 = "ServiceProviderProfiles"; 字符串孩子=“服务提供者”;

var nodePath = string.Concat(@"//", parent, @"/", children);
var xmlNode = xmlDocument.SelectSingleNode(nodePath);

当我调试时, xmlNode 为空。我的代码有什么问题导致 xmlNode 为空?

0 投票
1 回答
103 浏览

c# - 将变量放在 .SelectSingleNode 表达式中

我想编写一个方法来替换 XML 文件中某个节点的属性。这是我的代码。[Node] 应该是我选择我想要的正确节点的变量。例如“1, 2, 3, 4, 5, ...”

这是我的 XML,我想选择例如第二个“Guid”

0 投票
1 回答
2554 浏览

xml - VBA - SelectSingleNode 仅检索列表中的第一个节点

我正在使用 VBA 来操作 XML 文件。MS Office - 2013。我添加了库 - Microsoft XML Version6.0。请在下面找到xml以及代码。我正在尝试检索 xml 中的所有 TID 并写在工作表上。但是 selectsinglenode() 只检索第一个节点。我究竟做错了什么?有没有办法使用 selectsinglenode 返回每个 TID?请建议。如果您需要更多信息,请告诉我。

以下是代码: