Java Reference
In-Depth Information
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="height" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:minExclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
The width and height are identified and are both restricted to be non-negative integers with a minimum
value of 2.
Defining a Rectangle Element Type
The definition of the type for a <rectangle/> element is somewhat similar to the LineType definition:
<!--Type for a sketch rectangle element -->
<xsd:complexType name="RectangleType">
<xsd:sequence>
<xsd:element name="color" type="ColorType"/>
<xsd:element name="position" type="PointType"/>
<xsd:element name="bounds" type="BoundsType"/>
</xsd:sequence>
<xsd:attribute name="width" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:double">
<xsd:minInclusive value="2.0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="height" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:double">
<xsd:minInclusive value="2.0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
This references the schema element types ColorType , PointType , and BoundsType , and all of these
have already been defined. The definition for the width and height attributes are slightly different from
the <bounds/> element because they are floating-point values. This is because they relate to a Rect-
angle2D.Double object whereas a bounding rectangle is a java.awt.Rectangle object with integer width
and height values.
Defining a Circle Element Type
There's nothing new in the definition of CircleType :
Search WWH ::




Custom Search