It's not a secret anymore!
The moose likes XML and Related Technologies and the fly likes IDREF AND IDREFS. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "IDREF AND IDREFS." Watch "IDREF AND IDREFS." New topic


Vasudha Deepak
Ranch Hand

Joined: Mar 15, 2002
Posts: 86
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?

IBM Certified Developer -XML and Related Technologies(141)<br />SCJP2 SCWCD
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
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

Joined: Mar 15, 2002
Posts: 86
Thanks a lot.
I agree. Here's the link:
It's not a secret anymore!