Java Reference
In-Depth Information
<xsd:attribute name="G" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:maxInclusive value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="B" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:maxInclusive value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
Now, only values from 0 to 255 are acceptable for the color components.
Defining a Type for Point Elements
You saw a definition for the PointType element type earlier:
<!--Type for elements representing points -->
<xsd:complexType name="PointType">
<xsd:attributeGroup ref="coords"/>
</xsd:complexType>
This references the attribute group with the name coords , so this must be defined elsewhere in the
schema. You've also seen this attribute group definition before:
<!--Attribute group for an x,y integer coordinate pair -->
<xsd:attributeGroup name="coords">
<xsd:attribute name="x" type="xsd:integer" use="required"/>
<xsd:attribute name="y" type="xsd:integer" use="required"/>
</xsd:attributeGroup>
You are able to use this attribute group in the definitions for other element types in the schema. The defin-
ition of this attribute group must appear at the top level in the schema, within the root element; otherwise, it
is not possible to refer to it from within an element declaration.
Defining a Type for Bounds Elements
The BoundsType corresponds to the bounding rectangle for an element. You need to specify the coordinates
of the top-left corner and its width and height:
<!--Type for a bounding rectangle for a sketch element -->
<xsd:complexType name="BoundsType">
<xsd:attributeGroup ref="coords"/>
<xsd:attribute name="width" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:minExclusive value="2"/>
</xsd:restriction>
Search WWH ::




Custom Search