我想读取如下 XML 文件
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.ibm.ws.st.core.runtimeClasspathProvider/com.ibm.worklight"/>
<classpathentry kind="con" path="com.worklight.studio.plugin.classpath.SERVER_CONTAINER"/>
<classpathentry kind="src" path="server/java"/>
<classpathentry kind="src" path="common"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" output="adapters/adp1/bin" path="adapters/agent/src"/>
<classpathentry kind="src" output="adapters/adp2/bin" path="adapters/alerts/src"/>
<classpathentry kind="src" output="adapters/adp3/bin" path="adapters/billing/src"/>
<classpathentry kind="src" output="adapters/adp4/bin" path="adapters/client/src"/>
<classpathentry kind="src" output="adapters/adp5/bin" path="adapters/category/src"/>
</classpath>
我想读取path
where kind
is的值"src"
。我能够获得所有路径值,但无法暗示它的条件。我正在使用以下代码。
<target name="xml">
<echo>Test For Each</echo>
<for list="${classpath.classpathentry.path}" param="letter" delimiter=",">
<sequential>
<echo message="path ::: @{letter}"/>
</sequential>
</for>
</target>
它适用于所有path
值,但我应该怎么做才能获得path
where kind
is的值"src"
?