• 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

Need help with a practice question

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following would raise an error if the empID attribute's data type were 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> Multiple
Select - Please select all of the correct answers (this question has 2 correct choices). Ans: a, d. - please explain.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Attributes that are declared to be of type ID must be legal XML name tokens.
Please check out the following discussion about the same topic:
https://coderanch.com/t/146982/po/certification/Type-ID-DTD
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the empID attribute's data type were defined as type ID in the DTD, the first character of this attribute may only be a letter, underscore or a colon.
 
C Wong
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the prompted response. I got it now.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but i test all the four choices in the xmlspy,i found the b is also wrong,prefix "ft" is not allowed,and the string behind the prefix is not start with a letter!
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Daniel,
<name empID="ft:17563">Joe Smith</name>
ft:17563 has nothing to do with prefix, namespace or some such.
ft:17563 is the content of the text node of the attribute.
All characters of "ft:17563" are allowed to qualify as legal xml name tokens.
[ March 18, 2003: Message edited by: Axel Janssen ]
 
Daniel Washington
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
to Axel:
the ":" in the string is not allowed,i test in xmlspy,she said:invalid value.when i del the ":",it's ok!
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the exam purpose, you should consider the XML recommendation as the absolute authoritative reference and not implementing tools like XMLSpy.
In the recommendation, it is stated in 3.3.1 Attribute Types that "Values of type ID must match the Name production." and the Name (and NameChar) productions are specified as
Name ::= (Letter | '_' | ':') (NameChar)*
NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
As you can see, the : character is perfectly admissible in attribute values. XMLSpy must have skipped that part
[ March 18, 2003: Message edited by: Valentin Crettaz ]
 
Daniel Washington
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
really thank you very much.&bow
 
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic