Note that there are some explanatory texts on larger screens.

plurals
  1. POAnt: Can I get a specific property from a xml file?
    primarykey
    data
    text
    <p>I use ant to install servers for test. In the properties file I have a list of parameters for the database. The problem is that I need to change 5-6 parameters when a database is changed. Most of these are depending on the database name. So I thought that I create a xml file with all the different databases we use and just enter the name in the properties file. Then when the build file is running it gets the correct properties for the database used. I created a xml-file like this:</p> <pre><code>&lt;databases&gt; &lt;database&gt; &lt;server&gt;mssql_1&lt;/server&gt; &lt;port&gt;1433&lt;/port&gt; &lt;sid_instance&gt;foobar&lt;/sid_instance&gt; &lt;path&gt;&lt;/path&gt; &lt;hostuser&gt;sa&lt;/hostuser&gt; &lt;hostpwd&gt;password&lt;/hostpwd&gt; &lt;/database&gt; &lt;database&gt; &lt;server&gt;oracle_1&lt;/server&gt; &lt;port&gt;1521&lt;/port&gt; &lt;sid_instance&gt;foobar&lt;/sid_instance&gt; &lt;path&gt;C:\\oracle\\oradata\\foobar&lt;/path&gt; &lt;hostuser&gt;system&lt;/hostuser&gt; &lt;hostpwd&gt;password&lt;/hostpwd&gt; &lt;/database&gt; &lt;/databases&gt; </code></pre> <p>I call the file in my build file with:</p> <pre><code>&lt;xmlproperty file="databases.xml" /&gt; </code></pre> <p>So when my property file states that "mssql_1" are to be used, I want the matching properties loaded.</p> <p>But no matter how I try to select the correct data, I get all ports like: "1433, 1521" when I try with </p> <pre><code>&lt;echo message="${databases.database.port}"&gt; </code></pre> <p>I have searched for different ways to do this but I can't find a way to do this. But it seems like it <em>should</em> be an easy thing to do.... </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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