Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 21st, 2006, 09:25 AM
Maulik Thaker
Guest
 
Posts: n/a
Default querry on ID's and IDREF in DTD

Hi ppl,

I have a querry based on ID. Suppose if i have got two primary keys
(ID) and one foreign key (IDREF) in the same attribute, is there a way
to use them.



For example :

INSTRUCTUR

1) FirstName varchar(32) Primary key
2) LastName varchar(32) Primary key
3) emailID varchar(64) Foreign Key

Now the question is what could be the possible DTD for this kind of
situation.
Can anyone please let me know regarding this and if u have any good
suggestions for the weblink for such kind of DTD's please let me know.

Thanks in advance.

Maulik.

  #2  
Old February 21st, 2006, 01:45 PM
Joe Kesselman
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

DTDs do not support the concept of multiple keys. Only one attribute per
element type may be declared as having type ID.

(http://www.w3.org/TR/2004/REC-xml11-...#one-id-per-el)

If you're working with schemas rather than DTDs, you could try using
keys rather than IDs. Or you could just have your software explicitly
search for elements that have the appropriate attribute/value pair,
using XPaths or something of that sort.
  #3  
Old February 24th, 2006, 09:15 AM
Aalap
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

Hi,

but what if i wanted to implement that structure using DTD only..

Thanks
Aalap
Joe Kesselman wrote:[color=blue]
> DTDs do not support the concept of multiple keys. Only one attribute per
> element type may be declared as having type ID.
>
> (http://www.w3.org/TR/2004/REC-xml11-...#one-id-per-el)
>
> If you're working with schemas rather than DTDs, you could try using
> keys rather than IDs. Or you could just have your software explicitly
> search for elements that have the appropriate attribute/value pair,
> using XPaths or something of that sort.[/color]

  #4  
Old February 24th, 2006, 12:45 PM
Joe Kesselman
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

>>DTDs do not support the concept of multiple keys. Only one attribute per[color=blue][color=green]
>>element type may be declared as having type ID.[/color]
> but what if i wanted to implement that structure using DTD only..[/color]

Then the DTD can't help you. As I said:
[color=blue][color=green]
>> Or you could just have your software explicitly
>>search for elements that have the appropriate attribute/value pair,
>>using XPaths or something of that sort.[/color][/color]

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
  #5  
Old February 24th, 2006, 05:35 PM
Aalap
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

hey

Thanks again.....

suppose i took instructor as an element and first name , last name ,
email as the child elements.......and each element should have an
attribute called first name ,last name and email respectively . and in
that case first name and last name can have and ID rt?

Aalap

  #6  
Old February 24th, 2006, 05:55 PM
Joseph Kesselman
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

> suppose i took instructor as an element and first name , last name ,[color=blue]
> email as the child elements.......and each element should have an
> attribute called first name ,last name and email respectively . and in
> that case first name and last name can have and ID rt?[/color]

Yes. Ugly, but yes.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
  #7  
Old February 25th, 2006, 02:45 AM
Aalap
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

Hey thanks.......a lot !!!

  #8  
Old February 25th, 2006, 03:15 AM
Joe Kesselman
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

Note that IDs must be unique, though. So if you make firstname an ID,
nobody else can have the same firstname; if lastname is also an ID, not
only can no two people have the same lastname, but no lastname can be
the same as any firstname.

I doubt that's what you're trying to achieve. IDs are generally the
wrong solution for anything except pointing to a specific location in a
document.


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
  #9  
Old February 25th, 2006, 09:05 AM
Aalap
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

Hey

even i just realised that . i surely dont want that
So there is no way i can use ID for a composite key for a table....
also i am getting and error in XML spy
This file is not valid:
Required attribute 'dept' is missing.
even though i have it in the dtd .

Thanks
Aalap

  #10  
Old February 25th, 2006, 02:25 PM
Joe Kesselman
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

> Required attribute 'dept' is missing.[color=blue]
> even though i have it in the dtd .[/color]

Sounds like the problem is that you do have it in the DTD but it's
missing in the instance document.


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
  #11  
Old February 25th, 2006, 05:35 PM
Aalap
Guest
 
Posts: n/a
Default Re: querry on ID's and IDREF in DTD

And what abt the composite key thing....can i implement it using the
DTD
`

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles