- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 MSBUILD 项目文件,我正在尝试 checkout 一些 xml 文件并更新版本元素,但似乎无法让它为我的生活工作。这似乎应该是一个简单的解决方案,但我无法让它工作。我有一个简单的 xml 文件:
<?xml version="1.0" standalone="yes"?>
<DataSet>
<Profile>
<Product>ProductA</Product>
<Version>1.2.3.4</Version>
</Profile>
~
</DataSet>
<XmlPeek XmlInputPath="c:\myProfile.xml"
Query="DataSet/Profile/Version[../Product = "ProductA"]/text()">
<Output TaskParameter="Result" ItemName="ProductVersion" />
</XmlPeek>
<MSBuild.ExtensionPack.Xml.XmlFile
TaskAction="UpdateElement"
File="c:\machine.config"
XPath="/configuration/configSections/section[@name='system.data']"
InnerText="NewValue"/>
<MSBuild.ExtensionPack.Xml.XmlFile
TaskAction="UpdateElement"
File="c:\myProfile.xml"
XPath="/DataSet/Profile/Version[@Product='ProductA']"
InnerText="5.6.7.8"
/>
最佳答案
在 XPath 中,@
用于引用属性,如 @attribute_name
.所以你尝试的 XPath 的一部分 Version[@Product='ProductA']
, 将寻找 Version
具有 Product
的元素属性值等于“ProductA”,类似于以下内容(在您的 XML 中不存在):
<Version Product="ProductA"/>
Version
的正确 XPath元素
Product
名称如下:
/DataSet/Profile[Product='ProductA']/Version
Profile[Product='ProductA']
, 过滤器
Profile
具有子元素的元素
Product
等于“产品A”。
关于xml - 使用 MSBuild.ExtensionPack.Xml.XmlFile UpdateElement 更新 XML 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37259357/
我有一个页面,其中有多个编辑器类为“.ckeditor”。 我正在尝试更新 blur 的值,但 blur 没有触发。 $(".ckeditor").on("blur", function() {
我已将 CKeditor 应用到表单上的文本区域,但在序列化表单后,我检查它没有从该字段获取数据(描述)我在 CKEditor 的文档中找到了这个: CKEDITOR.instances.descri
本文整理了Java中org.eclipse.xsd.XSDConcreteComponent.updateElement()方法的一些代码示例,展示了XSDConcreteComponent.upda
我有一个 MSBUILD 项目文件,我正在尝试 checkout 一些 xml 文件并更新版本元素,但似乎无法让它为我的生活工作。这似乎应该是一个简单的解决方案,但我无法让它工作。我有一个简单的 xm
我是一名优秀的程序员,十分优秀!