Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Type ID in DTD

 
Ravikiran Muvva
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is a sample question in XML 141 sample test.Can anyone explain me why a,d are the correct answers for this??
Which of the following would raise an error if the empID attribute's data type was defined as type ID in the DTD?
a) <name empID="17563">Joe Smith</name>
b) <name empID="ft:17563">Joe Smith</name>
c) <name empID="a17563">Joe Smith</name>
d) <name empID="">Joe Smith</name>

Thanks in advance
rkmuvva
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attributes defined as ID must contain only characters allowed for NMTOKEN (letters, digits, point [ . ] , hyphen [ - ], underline [ _ ] and colon [ : ] ) and must start with a letter.
b and c satisfy to this rule whereas a and d don't.
For more details, please consult
Zvon.org DTD tutorial
W3C XML specification
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attributes defined as ID must contain only characters allowed for NMTOKEN (letters, digits, point [ . ] , hyphen [ - ], underline [ _ ] and colon [ : ] ) and must start with a letter.
On the same rule, has anyone heard of Processors/Parsers giving errors because the ID value has a "." (period) in the value. Acc. to this rule, it seems to be valid.
- madhav
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic