This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes XML Namespace Spec Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "XML Namespace Spec" Watch "XML Namespace Spec" New topic
Author

XML Namespace Spec

Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
Now this question of niko's

Q.7 Is this a valid use of header.tag, a JSP tag file that is located in WEB-INF/tags? (1 correct answer)

<%@ taglib prefix="1" tagdir="/WEB-INF/tags" %>
<html>
<body>
<1:header />
</body>
</html>

1. Yes.
2. No.
Answer: 1

Here 1 is used as a prefix . Spec says
A prefix must follow the naming convention specified in the
XML namespaces specification.


What is XML namespaces specification? Where can we get it from?

Parth Tiwari
| Pursuing Bachelor of Engineering | OSUM Club Leader | SCJP 6 | SCWCD 5 |...
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper

Joined: Apr 07, 2010
Posts: 2018
    
  39

I have no idea where you can get the XML namespaces specification, and how you should read it (I found one at w3c, but that one disallows digits as prefixes...)

The important thing to remember for the exam is the following:
Empty prefixes are illegal. If you are developing or using custom tags, you cannot use the tag prefixes jsp, jspx, java, javax, servlet, sun, and sunw, as they are reserved by Sun Microsystems

Funny enough you can also use an underscore as a valid prefix.

Regards,
Frits
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

You'll find the grammatical rules of the namespace here.

NCName ::= (Letter | '_') (NCNameChar)*
NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender

The namespace must start with a letter or an underscore. But as Frits said, you don't need to remember this for the exam.


[My Blog]
All roads lead to JavaRanch
Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
Ok thanks..
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper

Joined: Apr 07, 2010
Posts: 2018
    
  39

Ok, then I was looking in the same place as Christophe.

Again this is a question where the answer is questionable: Tomcat allows it but according to the rules it should not have been possible...

Regards,
Frits
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML Namespace Spec
 
It's not a secret anymore!