KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > relaxng > impl > AttributeNameClassChecker


1 package com.thaiopensource.relaxng.impl;
2
3 import com.thaiopensource.xml.util.WellKnownNamespaces;
4 import com.thaiopensource.xml.util.Name;
5
6 class AttributeNameClassChecker implements NameClassVisitor {
7   private String JavaDoc errorMessageId = null;
8   
9   public void visitChoice(NameClass nc1, NameClass nc2) {
10     nc1.accept(this);
11     nc2.accept(this);
12   }
13
14   public void visitNsName(String JavaDoc ns) {
15     if (ns.equals(WellKnownNamespaces.XMLNS))
16       errorMessageId = "xmlns_uri_attribute";
17   }
18
19   public void visitNsNameExcept(String JavaDoc ns, NameClass nc) {
20     visitNsName(ns);
21     nc.accept(this);
22   }
23
24   public void visitAnyName() { }
25
26   public void visitAnyNameExcept(NameClass nc) {
27     nc.accept(this);
28   }
29
30   public void visitName(Name name) {
31     visitNsName(name.getNamespaceUri());
32     if (name.equals(new Name("", "xmlns")))
33       errorMessageId = "xmlns_attribute";
34   }
35
36   public void visitNull() { }
37
38   public void visitError() { }
39
40   String JavaDoc checkNameClass(NameClass nc) {
41     errorMessageId = null;
42     nc.accept(this);
43     return errorMessageId;
44   }
45 }
46
Popular Tags