Groups | Blog | Home
all groups > dotnet xml > october 2005 >

dotnet xml : simpleType Question


Mike Logan
10/27/2005 4:04:03 AM
Is this correct?

I am representing my database in an XML schema, but I am not just naming an
element=database field. But some of my IDs (i.e. USER_ID, and PROFILE_ID)
are not the same length in numbers. They are defined in the database as
NUMBERPS(2,0), NUMBERPS(3,0),...,NUMBERPS(8,0). Therefore in my complexTypes
should my ID/Identity fields use a simpleType with the limiting facets.

For example:

<xs:complexType name="application">
<xs:sequence>
<xs:element name="app_id" type="id4" />
<xs:element name="enabled_ind" type="indicator" />
<xs:element name="application_desc" type="xs:string"/>
<xs:element name="application_guid" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="id4">
<xs:restriction base="xs:int">
<xs:minInclusive value="1" />
<xs:totalDigits value="4" />
<xs:maxExclusive value="9999" />
</xs:restriction>
</xs:simpleType>

Is this good design, too restrictive, or what? My database cannot accept
something different, therefore I would assume, I should be strict.
--
Zafar Abbas
10/27/2005 10:28:40 AM
Yes you can use such a restriction. In this particular case you do not need
to have a maxEx facet since you already defined the min and totalDigits.

[quoted text, click to view]

AddThis Social Bookmark Button