How do you want to write a `xsd:float {minInclusive="0"}` declaration in lzx? To use it as the type doesn't really looks nice:
<attribute name="duration" type="xsd:float {minInclusive='0'}" />

I'd rather prefer this more verbose form:
<attribute name="duration" type="number">
  <xsd:restriction base="xsd:float">
    <xsd:minInclusive value="0"/>
    <xsd:maxInclusive value="60000"/>
  </xsd:restriction>
</attribute>

On 5/26/2010 2:53 PM, P T Withington wrote:
So, it seems the bug is partly saying `| constraint`, because any non-final 
attribute is, in theory, constrainable (there may be some that don't work, but 
that would be a bug in either the declaration or the implementation).

Secondly, I think we would like to support the XSD declaration for non-negative 
number, so we ought to teach convertAttributeType about that.

Finally, we don't currently have a way to express that restriction in 
Javascript (although perhaps some day we will).  So for now, it is really just 
a descriptive declaration.

I'm willing to accept just changing the declaration to `number`, but if so, we should 
file an improvement to support the `xsd:float {minInclusive="0"}` declaration.

On 2010-05-26, at 07:56, André Bargull wrote:

The schema compiler changes any enumeration [1] (like "foo | bar | baz") to "string" type, because enumerations are 
only used (intended to be used?) for string values [2]. Therefore declaring<animatorgroup>#duration's type to 'xsd:float 
{minInclusive="0"} | constraint' is just wrong. We could change the type to 'xsd:float {minInclusive="0"}', but 
then the schema compiler needs to change it to "number" again, because the schema reader doesn't understand that type [3].
We just don't have any facility like in xsd to constrain attributes to valid 
values. I don't even know if such a facility is feasible at compile time due to 
constraints.


[1] except for boolean | 'inherit' which becomes inheritableBoolean, see 
SchemaBuilder#convertAttributeType()
[2] complete list of enumeration types from lfc.lzx schema file:
<node>#initstage,<animatorgroup>#motion,<animatorgroup>#process,<datapath>#axis,<datapath>#replication,<dataset>#querytype,<dataset>#type,<script>#when,<view>#align,<view>#backgroundrepeat,<view>#stretches,<view>#valign,<include>#type
[3] cf. SchemaBuilder#convertAttributeType()

On 5/26/2010 1:29 PM, P T Withington wrote:
Sorry, this got lost in my inbox.

My question is:  clearly the intent is to have the schema indicate (and if you 
have a verifier, verify) that an animation duration must be non-negative.  So 
the real bug lies in the schema compiler, not in the declaration.  So shouldn't 
we really be fixing that?

To change the XML type declaration to "number" is acceptable if there is no way 
to fix the schema compiler.

On 2010-05-07, at 12:36, André Bargull wrote:

Change 20100507-bargull-4X2 by barg...@bargull02 on 2010-05-07 18:18:33
in /home/anba/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: change lz.animatorgroup#duration lzxtype to "number"

New Features:

Bugs Fixed: LPP-8980 (http://jira.openlaszlo.org/jira/browse/LPP-8980)

Technical Reviewer: ptw
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:
lz.animatorgroup#duration type has been changed to "number"

Overview:


Details:
This is a change for the @lzxtype for lz.animatorgroup#duration. The lzxtype was set to 'xsd:float 
{minInclusive="0"} | constraint' which was treated as an enumeration type by the schema 
compiler and therefore the actual type was "string". This means any value for the duration 
attribute written in the<animatorgroup>   tag was changed to a String in script. That's for sure 
not the desired result for a numeric type like duration.
With this change, the @lzxtype is updated to "number". There is only one potential issue: Users will have to update<attribute 
name="duration" value="..." type="string"/>   to<attribute name="duration" value="..." 
type="number"/>. Although I doubt anyone is really using that form.


Tests:
testcase from bugreport

Files:
M WEB-INF/lps/lfc/controllers/LzAnimatorGroup.lzs

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20100507-bargull-4X2.tar





Reply via email to