While trying to write a simple translator, I figured out that
I either had the wrong expecations or that I am doing something wrong.
 
My expectation with Translators and default values is like this.
If I have an attribute element in a schema like this:
 
 <element name="counter">
  <attribute name="count" translator="int,min=5,max=10,default=5"/>
  <conversion ... />
 </element>
 
and I make such a contribution:
 
 <counter/>
 
than I would expect to get the default value for the count property specified
in the translator attribute. But this seems to be wrong. The translator does
not get called in such a case.
I need to do something like this:
 
 <counter count=""/>
 
Now the translator gets called and the specified default value will be set.
 
But, shouldn�t the translator not be called in any case (except when a requiered
attribute is not given, which is an error). Otherwise I need to have two
places dealing with default values, one in the translator specification
and one in Java code.
And additionally the code can not rely on the specification, because in
the above example the int property count would get 0 (if not handled
explicitly) and this would violate the �min� specification in the translator.
 
Stefan

Reply via email to