• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DTD - IDREF

 
lavanya Ananth
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's me again. Pls rad thru the DTD below.

<! ELEMENT bookstore ( shipping+, book+, officesupplies+) >
<! ELEMENT shipping ( duration) >
<! ATTLIST shipping shipID ID #REQUIRED >
<! ELEMENT book ( title , author) >
<! ATTLIST book bookno ID #REQUIRED shippedBy IDREF #IMPLIED >
<! ELEMENT duration ( #PCDATA) >
<! ELEMENT title ( #PCDATA) >
<! ELEMENT author( #PCDATA) >

If i wanted to have an attribute for title , say ISBN which refers to book no, how do i specify it? Is the declaration below correct?

<! ATTLIST title ISBN IDREF #REQUIRED >

How does the parser know which ID the above decl references?

I am also assuming that a single element can have two attributes that are unique. How do we then use IDREF to refer to a particular unique attribute?


Thanks in Advance,
Lavanya
 
Hari Vignesh Padmanaban
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by lavanya Ananth:

If i wanted to have an attribute for title , say ISBN which refers to book no, how do i specify it? Is the declaration below correct?

<! ATTLIST title ISBN IDREF #REQUIRED >

It is perfect


How does the parser know which ID the above decl references?

I am also assuming that a single element can have two attributes that are unique. How do we then use IDREF to refer to a particular unique attribute?



According to the DTD specifications, there may be only ONE ID attribute for each element type

So I guess that the DTD parser would know which one to look for

Hope that helps
[ December 28, 2005: Message edited by: Hari Vignesh Padmanaban ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic