• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock exam question

 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
This is from the XML whiz mock exam.
How can you declare in a DTD that the element a has the attribute x or y but not both of them?
My answer was this
<!ATTLIST a (x|y) CDATA #REQUIRED>
But the correct answer is
It is not possible to make the presence of one attribute dependent on another attribute.
Am i missing something here. please help
Hari
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the ATTLIST syntax -

The first parameter is the element name, followed by the attribute name. BTW, (x|y) is not even a valid XML name.
Cheers,
Dan
 
Rakesh Gudur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hari babu,
In a DTD you cannot make a declaration for attributes as "x or y but not both". This type of declaration is not possible for attributes. It is possible for elements only.
The answer 'It is not possible to make the presence of one attribute dependent on another attribute.' is correct.
Thanks,
Rakesh.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic