On Oct 22, 2011, at 10/227:59 AM , Wechsung, Wulf wrote:

> Hi Robert,
> 
> thanks for your response!
> 
> I see. I understand that the attribute order (even element order ...) in the 
> document is supposed to be insignificant but does that really mean that the 
> information about the attribute order should be actively discarded ie that 
> code that does processing on any kind of XML *must* never take attribute 
> order into account? To me, that's a completely counter-intuitive approach. 
> Apparently, also one that a significant amount of XML-based and related 
> technologies do not follow. For browsers document order is clearly not 
> "insignificant" and neither is it for anything based on xpath (for example, 
> what is use could //root/element[0] possibly have if it doesn't refer to the 
> document order?).
> 

There's a significant difference between element order and attribute order. 
Element order is meaningful to an XML parser; attribute order is not.  You're 
hitting the weird intersection, however, of attributes + elements, since 
informal parameters can be either.

As for DRY, I see no reason for repeating yourself here. Consider, eg:

page.tml:

<t:tabcomponent tabs="tab1,tab2,tab3"><!-- you could have a coercion from, eg, 
string to "tabmodel" if necessary... but that's probably not even necessary -->
   <p:tab1>
       <!-- content goes here -->
   </p:tab1>
   ...
</t:tabcomponent>

page.properties:
tab1-label=Tab One
tab2-label=Tab Two
tab3-label=Tab Three

Your component can grab the labels from the page properties file, and now 
you're not instantiating another model, and you gain the benefit of having 
i18n'ed your tab headers, so if/when you add a language, you simply add the 
appropriate properties file (eg: page_de.properties), and your component just 
works.

In fact, Tapestry facilitates this sort of approach:

@Inject
private ComponentResources resources;

resources.getContainerMessages().get("tab1-label");

Cheers,

Robert


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to