• Post Reply Bookmark Topic Watch Topic
  • New Topic

XML Namespace Spec

 
Parth Twari
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2781
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Parth Twari
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanks..
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2781
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!