• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DTD - IDREF

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic