question

I work on  DTD Content model
I have question : How to bind the  data ? I mean how to represent relations
between tables  ?
For example, I have two tables: Account and Account Type

                                               Account

Column	Data Type	Allow NULL	Unique	In PK	
AccountID	uniqueidentifier	No	Yes	Yes	
AccountName	varchar(64)	No	No	No	
CommunityID	int	No	No	No	
CreationDate	datetime	No	No	No	
IsActive	char(1)	No	No	No	
AccountHolder	uniqueidentifier	No	No	No	
ViewID	uniqueidentifier	No	No	No	
SignatureImage	image	Yes	No	No	

AccountAffiliation

Column	Data Type	Allow NULL	Unique	In PK	
AffiliationID	uniqueidentifier	No	Yes	Yes	
AccountID	uniqueidentifier	No	Partial	No	
UserID	uniqueidentifier	No	Partial	No	
RoleID	int	No	No	No	
IsDefaultAffiliation	char(1)	No	No	No	
AffiliationStatusMask	int	No	No	No	
AccountAddressID	uniqueidentifier	Yes	No	No	
PermissionMask	int	No	No	No	



I want  to design my DTD schema and show, that  AccountID and UserId is the
same in both tables
I'm creating two groups: Account and AccountAffiliation.


<?xml version='1.0'?>

<!DOCTYPE schema>
SYSTEM 'http://www.docutouch.com/xmlschema/structures.dtd' >
        xmlns="http:www.docutouch.com/xmlschema/structures.dtd' ">

<schema targetNS="http://www.docutouch.com/xmlschema/Operations
<http://www.docutouch.com/xmlschema/Operations> "
        version="1.0"
        xmlns="http://www.docutouch.com/xmlschema
<http://www.docutouch.com/xmlschema> ">
	<annotation>
				<documentation xml:lang="en"
source="http://www.docutouch.com/DesignRecords.doc
<http://www.docutouch.com/DesignRecords.doc> ">
      			The schema corresponding to this document is
normative
      			with respect to the syntactic constraints it
expresses in the
      			XML Schema language.  
    		</documentation>
  	</annotation>

  

<type name="unique" type="boolean"/> 
</type>
<type name="allowNull" type="boolean"/> 
</type>
<type name="inPK" type="boolean"/> 
</type>

<group name="Account">
 	<element ref="AccountID"/>
 	<element ref="AccountName"/>
 	<element ref="CommunityID"/>
 	<element ref="CreationDate"/>
 	<element ref="IsActive"/>
 	<element ref="AccountHolder"/>
 	<element ref="CreationDate"/>
 	<element ref="ViewID"/>
 	<element ref="SignatureImage"/>

</group>

<element name="AccountID" />
 <type>
  <group ref="Account"/>
   <attribute name="type" type="integer" > 0 />  
   <attribute name "unique" unique='true'/>
   <attribute name "allowNull" allowNull="false" />
    <attribute name "inPK" inPK='true'/> 	
 </type>
</element>

<element name="AccountName">
 <type>
   <group ref="Account"/>
   <attribute name="type" type="string"/>   
   <maxLength value='64'/>   
   <element ref="AccountID"/>
 </type>
</element>

<element name="CommunityID">
 <type>
   <group ref="Account"/>
   <attribute name="type" type="integer"/> 
   <attribute name "unique" unique='false'/>
    <attribute name "allowNull" allowNull="false" /> 
   <element ref="AccountID"/>
 </type>
</element>  

Thanks
Anna

Received on Tuesday, 16 January 2001 11:46:52 UTC