XMLTasksを使用してXMLファイルの一部の値を置き換えようとしていますが、他のツールを使用すると、私のxpathが正しいと言われますが、何が間違っているのか分かりません。XMLTasksを使用したAntからのXMLPathは、XMLファイルに異なる名前空間の要素がある場合には一致しません。
ここ私が探していたファイル:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>simple.server.extension.cardgame</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>marauroa.lib</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>3</release-version>
<specification-version>8</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>simple.server.lib</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>0-1</release-version>
<specification-version>0.2</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages>
<package>dreamer.card.game</package>
<package>dreamer.card.game.model.events</package>
<package>dreamer.card.game.price</package>
<package>dreamer.card.game.storage</package>
<package>simple.server.extension</package>
<package>simple.server.extension.card</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/extension/x.jar</runtime-relative-path>
<binary-origin>../../Simple Marauroa Java/Card Game Extension/dist/x.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/extension/y.jar</runtime-relative-path>
<binary-origin>../../Simple Marauroa Java/Card Game interface/dist/y.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
</project>
そして、これは私が使用しているパス式である:ここで
/project/configuration/data/class-path-extension[1]/runtime-relative-path/text()
は私がしようとしているタスクの関連する部分ですが実行:
<target name="s" depends="-define-xmltasks">
<propertyselector property="subprojects" match="original.project.dir(.*)" select="\1"/>
<for list="${subprojects}" param="subproject">
<sequential>
<xmltask source="nbproject/project.xml" dest="nbproject/project.xml" failWithoutMatch="true">
<replace path="/project/configuration/data/class-path-extension[@{subproject}]/runtime-relative-path/text()"
withText="ext/extension/${[email protected]{subproject}.dist.jar}"/>
<replace path="/project/configuration/data/class-path-extension[@{subproject}]/binary-origin/text()"
withText="${[email protected]{subproject}}/dist/${[email protected]{subproject}.dist.jar}"/>
</xmltask>
</sequential>
</for>
</target>
{サブ}は番号に解決し、既に数のためにそれを変更しようとしたが、同じ効果を持ちます@ 。何か案が?
他の貴重なxpathツールについてはhttp://sourceforge.net/projects/xpe/files/xpe/20030304/を参照してください。使用可能なスタンドアロンおよびEclipseプラグインとして。 eclipse用の別のxpathプラグインは、Xpath-Developerです。http://www.bastian-bergerhoff.com/eclipse/features/web/XPathDeveloper/toc.html – Rebse