It is because some attributes won't make sense until the element is fully
constructed. For example:
<CardPane selectedIndex="0">
<Label text="foo"/>
<Label text="bar"/>
</CardPane>
Attempting to set the selected index before the sub-elements are added will
produce an IndexOutOfBoundsException.
Since there shouldn't be any harm in waiting until the closing tag to apply the
attributes, this is the policy BXMLSerializer adopts.
On Jul 26, 2010, at 7:26 PM, Michael Allman wrote:
> I'm wondering... why doesn't the serializer (WTKXSerializer in my case) set
> the properties of the object it is constructing in the processStartElement
> method instead of processEndElement? I had to move this initialization from
> the latter to the former in order to implement some kind of scripting
> functionality or something. Something having to do with having access to the
> object's properties while the script is running. I don't know. That was last
> week. I can dig it up if necessary. Anyway, I haven't run into any trouble
> with the change I made yet. It seems to me having access to property values
> as soon as possible is a good thing.
>
> Cheers,
>
> Michael