Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IDREF AND IDREFS.

 
Vasudha Deepak
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The concept of using IDREF is not clear.I understand that using IDREFS enables us to have multiple unique values for an ID type attribute,but what exaclty is the purpose of an IDREF?
Thanks,
Vasudha
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider a authorization store.
You will typically have n users and they need to be assigned to specific roles.
So you might want to declare role elements having attributes of type ID.
Then you might associate users with the role using an attribute of type IDREF.
<Role name="ADMIN" roleid="role_admin"/>
<Role name="USER" roleid="role_user"/>
<User name="Guido" assocrole="role_admin"/>
<User name="Rossum" assocrole="role_user"/>
and in the dtd
<!ATTLIST Role roleid ID>
<!ATTLIST User assocrole IDREF>
If a user can have multiple roles then assocrole must be of the type IDREFS
<User name="Rossum" assocrole="role_user role_admin"/>
 
Vasudha Deepak
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic