Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

mock exam question

 
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
 
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
 
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.
 
Police line, do not cross. Well, this tiny ad can go through:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic