ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prashant <prash...@pramati.com>
Subject Re: <xmlproperty> intra-element attribute property resolution issue
Date Tue, 23 Jan 2007 12:11:01 GMT
[Wild guess] I am not sure if the following Xerces Bug on attribute 
order preservation is relevant here.

http://issues.apache.org/jira/browse/XERCESJ-863

-Prashant

Jacob Kjome wrote:
> <xmlproperty> seems to have a problem with resolution of attributes within the
> current element.  It appears to resolve the attributes in alphabetical order. 
> If an attribute refers to the value of another attribute in the same element,
> the one doing the referring must come later in the alphabet, otherwise the
> value won't resolve.
>
>
> Here's the minimal XMLProperty file displaying the issue...
>
> <root-tag>
>   <app
>     n="some value"
>     o="${app.n}"
>     a="${app.n}"/>
> </root-tag>
>
>
> Here's a minimal build to test the XMLProperty file above and the properties it
> generates...
>
> <project name="test.xmlproperties" default="echovalues">
>     <xmlproperty
>         file="test.xmlproperties"
>         collapseAttributes="true"
>         keepRoot="false"
>         semanticAttributes="true"/>
>
>     <target name="echovalues">
>         <echo>
> app.n=${app.n}
> app.o=${app.o}
> app.a=${app.a}
>         </echo>
>     </target>
> </project>
>
>
> Here's the output...
>
> echovalues:
>      [echo]
>      [echo] app.n=some value
>      [echo] app.o=some value
>      [echo] app.a=${app.n}
>      [echo]
>
>
> Notice how ${app.o} resolves, but not ${app.a}.  If 'a' was made to be any
> letter after 'n', then it would resolve it just fine, just like 'o' did.
>
> Is this a known idiosyncracy of the XMLProperty task?  Is it, possibly, a
> compromise to increase resolution efficiency and reduce overall code complexity
> or is it just a bug?  To me, unless this is called out as a known issue (and
> maybe it is somewhere?), it's a bug.  In any case, this behavior makes
> XMLProperty brittle.  One shouldn't have to worry about the alphabetical order
> of attribute names in relation to what attributes can be referenced and which
> ones we can't.  If it's a bug, can it be corrected for Ant-1.7.1?
>
> Note that the following XMLProperty file provides a workaround, but the use of
> attributes -vs- nested tags, in this case, should be personal preference, not
> mandatory...
>
> <root-tag>
>   <app
>     n="some value"
>     o="${app.n}">
>     <a>${app.n}</a>
>   </app>
> </root-tag>
>
>
> Jake
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message