问题标签 [xmlpoke]

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 回答
442 浏览

xml - 命名空间和特定的 xpath

谁能告诉我如何从该文件中获取名称属性的 xpath:

我正在尝试为 nant xmlpoke 任务获取它,但没有成功。

谢谢。

0 投票
2 回答
2398 浏览

xml - 使用 nant 将属性添加到 xml 节点

有没有办法使用 nant 向 xml 节点(我有 xpath)添加属性?试过 xmlpoke 但它看起来只能更新现有属性。

谢谢。

0 投票
2 回答
4330 浏览

xml - 如何使用 Nant 的 xmlpoke 目标来删除节点

给定以下xml:

XMLPoke与以下 XPath 一起使用:

结果(如果替换字符串为空)是:

当我们真正想要删除子节点本身时,子节点的内容已被删除。期望的结果是:

必须根据 childnode 参数选择子节点。

0 投票
1 回答
2019 浏览

xpath - XmlPoke and unique nodes

I am trying to use an xmlpoke task to update a VS Project File (which is XML). In the Project root, there are multiple PropertyGroup nodes, I am trying to select the first one. The XML looks like this

I am using an xpath of //Project/PropertyGroup[1] to get the first PropertyGroup, but I get the error: “Non-unique xpath given //Project/PropertyGroup[1]”.

edit: sorry, I didn't think it mattered (but it does), Project has a namespace. I put the correct XML with the correct xmlpoke as an answer for any future searchers.

0 投票
1 回答
1707 浏览

nhibernate - 使用 nant xmlpoke 更改休眠配置

如何使用 nant 从 nhibernate.config 文件更改连接字符串

问题是所有示例都是关于更改属性值,但 nhibernate 有内部文本

情商:

我需要更改属性 connection.connection_string

这在这种情况下不起作用。

谢谢

0 投票
2 回答
1978 浏览

xpath - Nant 中的 xmlpoke - 如何更新找到的字符串的所有实例

嗨,我在我的 Nant 构建脚本中使用 Xpath 来更改开发环境和其他环境之间的一些配置变量。

我从这个例子中获取了语法:

该示例如下所示:

我想要的是与此类似的东西来搜索我的连接字符串并找到“localhost\SqlExpress”的所有实例并将它们更改为“localhost”

这可能吗?

0 投票
1 回答
1141 浏览

asp.net - 读取字符串中的分号时,nant 脚本中的 xmlpoke 出现问题

我有一个 nant 脚本试图更改我的 web.config 中的 URL 值,但 Nant 不断抛出此错误:

我将其追溯到 nant 脚本的 URL 中的分号。我首先在 URL 中使用分号的原因是 web.config 不喜欢与符号 (&)。所以我不得不将 & 替换为&. 这是我的 web.config 值:

我可以 xmlpoke web.config 中的所有其他“添加键”,但这个不是 xpath 问题。这是 nant 脚本:

所以问题不在于 web.config 中的分号,而在于 nant 脚本中的分号。我想我需要以某种方式转义 nant 脚本中的分号。任何人都知道如何执行此操作或其他方法以使其正常工作?

0 投票
2 回答
3958 浏览

xpath - 使用 msbuild xmlpoke 的正确方法

如果元素值与“ABB Automation Builder Platform.abpkg”匹配,我正在尝试设置元素的值

我的脚本使用 xmlpoke 如下:

我要修改的xml如下:

XmlPoke 任务无法更新元素值并给出消息“进行 0 次替换”。我也尝试过像

Query="//x:ProductUpdate/x:Packages/x:Package[x:FileName='ABB Automation Builder Platform.abpkg']/x:FileHash" OR Query=".//x:ProductUpdate/Packages/Package[ FileName='ABB Automation Builder Platform.abpkg']/FileHash"

我想知道我是否做错了?请注意,我不想对我的 xml 文档中的命名空间进行任何更改。

0 投票
1 回答
278 浏览

gruntjs - 在一项任务中更新选项,以便后续任务可以使用它们

我需要运行grunt-bump它会影响 . 中的版本号package.json,然后运行grunt-xmlpoke并使用新版本号更新配置文件。

所以我尝试了几件事。在grunt.initConfig我运行凹凸中,然后我运行 xmlpoke。

1) xmlpoke 需要grunt.file.readJSON('package.json').version

或者

2)在颠簸之后,我运行了一个自定义任务,将新版本添加到 grunt 选项中,并且 xmlpoke 的值为grunt.options("versionNumber")

在这两个版本中,xml 结果都是预凹凸版本。所以 xmlpoke 在任务运行之前获取它的值,并在调用它的任务时使用它们。但我需要它来获取上一个任务的结果。

有没有办法做到这一点?

0 投票
1 回答
1269 浏览

xml - 使用 XMLPoke 和 Nant 更新 XML 节点值

是否可以使用 xmlpoke 和 nant 更新节点值?我的新价值