aspose file tools*
The moose likes Product and Other Certifications and the fly likes Need help with a practice question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Need help with a practice question" Watch "Need help with a practice question" New topic
Author

Need help with a practice question

C Wong
Greenhorn

Joined: May 28, 2002
Posts: 18
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.
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
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:
http://www.coderanch.com/t/146982/po/certification/Type-ID-DTD


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
carey eng
Greenhorn

Joined: Jan 28, 2003
Posts: 2
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

Joined: May 28, 2002
Posts: 18
Thank you for the prompted response. I got it now.
Daniel Washington
Ranch Hand

Joined: Oct 26, 2002
Posts: 53
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!


IBM 141<br />IBM 285,286<br />IBM 700
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
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

Joined: Oct 26, 2002
Posts: 53
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
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
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

Joined: Oct 26, 2002
Posts: 53
really thank you very much.&bow
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help with a practice question