Click to See Complete Forum and Search --> : Setting attributes in schema


Soilworker
09-24-2003, 06:48 AM
I'm having a little problem with my schema.

What i'm trying to do is give an element an attribute in the schema, and then giving it a max value (which would be "999"). I think i've done it, but i'm not so sure if it works.

customer-id-number is meant to be the attribute that needs the max value.

here's the code:



<xsd:complexType name="customer-name" >
<xsd:sequence>
<xsd:element ref = "family_name"/>
<xsd:element ref = "given_name"/>
</xsd:sequence>
<xsd:attribute name="customer-id-number" type="xsd:integer" use="required" />
</xsd:complexType>

<xsd:element name="customer-id-number">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:maxInclusive value ="999"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

Soilworker
09-24-2003, 05:12 PM
i also have another problem where the scheme isn't loaded by the xml document, but i guess the above problem is a little more urgent.

Soilworker
09-25-2003, 04:47 AM
i dont get it, what's wrong with this forum? why isnt anyone helping?

Khalid Ali
09-25-2003, 08:37 AM
There is nothing wrong with the forums, people who respond a re volunteers, if some one visiting this site sees your problem and knows the answere they might decide to respond to you.Be patient

lillu
09-25-2003, 08:45 AM
Hi,

your xsd restriction looks fine to me... here's the example from www.w3schools.com

maxInclusive Specifies the upper bounds for numeric values (the value must be less than or equal to this value)

<xs:element name="age"><xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType></xs:element>