ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject RE: <xmlproperty> intra-element attribute property resolution issue
Date Tue, 23 Jan 2007 06:01:26 GMT
At 05:22 PM 1/22/2007, you wrote:
 >> -----Original Message-----
 >> From: Jacob Kjome [mailto:hoju@visi.com]
 >> Sent: Monday, January 22, 2007 3:13 PM
 >> To: Ant Users List
 >> Subject: Re: <xmlproperty> intra-element attribute property
 >> resolution issue
 >>
 >>
 >> I think Brian is correct.  XML attributes have no defined
 >> order other than the
 >> obvious alphabetical order, which might be an implementation
 >> detail.  Even so,
 >> I wonder if logic could be written to maximize resolution.
 >> If a property is
 >> found to not be resolved, it could be deferred until other
 >> attributes are
 >> processed.  If after all attributes are processed, a property
 >> is still not
 >> resolved, then so be it.  But it would make sense to try.  If
 >> it were to pose a
 >> performance issue, it could be an option of XMLProperty
 >> defaulting to 'false'.
 >> I'm not sure how complex the logic might be, but I would
 >> think it's doable.
 >>
 >> Jake
 >
 >It's not a solvable problem. How do you resolve this:
 >
 ><element a="${element.b}" b="${element.a}"/>
 >

I would argue that's not a relevant problem.  First of all, no one 
would write that because it is meaningless.  Secondly, it might go like this...

1.  parse 'a'
2.  can't resolve 'a' value.  Defer it for later processing to see if 
it's resolvable after other attributes are processed
3.  parse 'b'
4.  'a' is available, but I've recorded that it's an unresolved 
value, so defer until 'a' is resolved
5.  all attributes have been processed, so let's go back and try to 
resolve unresolved values
6.  attempt 'a' value property resolution: 'b' exists, but 'b' refers 
back to 'a'.  Detected circular reference.  Resolve 'a' as literal 
unresolved value of 'b' and vice-versa.

Now lets try something realistic...

<element a="${element.b} bar" b="foo"/>

1.  parse 'a'
2.  can't resolve 'a' value.  Defer it for later processing to see if 
it's resolvable after other attributes are processed
3.  parse 'b'
4.  all attributes have been processed, so let's go back and try to 
resolve unresolved values
5.  attempt 'a' value property resolution: 'b' exists so resolve 
property.  Final value "foo bar"


While the code might be a little difficult/complex, I don't think it 
is properly characterized as "not a solvable problem".


Jake

 >?
 >
 >--
 >Rick Genter
 >Principal Software Engineer
 >Silverlink Communications
 ><mailto:rgenter@silverlink.com>
 >



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


Mime
View raw message