Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Sounds to me like you need to use XPath to uniquely identify each component. First, <a href="https://stackoverflow.com/questions/1256238/ant-and-xml-configuration-file-parsing">there is a related SO question</a>. I guess you did not know to <a href="http://www.w3schools.com/xpath/" rel="nofollow noreferrer">search for Xpath, because that's what will help you in this situation</a>. Still, I'll summarize a few options in this answer.</p> <h2><a href="http://www.oopsconsultancy.com/software/xmltask/" rel="nofollow noreferrer">xmltask</a></h2> <p>Looks like the best option. To pull a XML value into a property:</p> <pre><code>&lt;xmltask source="map.xml"&gt; &lt;!-- copies to a property 'user' --&gt; &lt;copy path="/map/entry[@key='database.user']/@value" attrValue="true" property="user"/&gt; &lt;/xmltask&gt; </code></pre> <h2><a href="https://code.google.com/p/ant-xpath-task/wiki/Introduction" rel="nofollow noreferrer">ant-xpath-task</a></h2> <p>It also looks like it can pull values out of XML into system properties, but the documentation is sorely lacking:</p> <pre><code>&lt;target name="find-hrefs"&gt; &lt;xpath document="foo.xhtml" xpath="/html/body/a/@href" outputproperty="hrefs"/&gt; &lt;/target&gt; </code></pre> <h2><a href="http://ant.apache.org/manual/Tasks/scriptdef.html" rel="nofollow noreferrer">Script Engine via Ant</a></h2> <p>This is mentioned in the related SO question. It uses Javascript in the answer to extract data out of the XML and store it in system properties. Nowadays though, maybe you can use Groovy or Scala script engine support for a more succinct syntax.</p> <h2><a href="http://ant.apache.org/manual/" rel="nofollow noreferrer">Core style ant task</a></h2> <p>Use a <a href="http://www.w3schools.com/xsl/" rel="nofollow noreferrer">XSLT to perform manipulation on XML</a>. That won't help you pull values out of the XML I think, but you might need to change some values or nodes.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload