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 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 ns) { 15 if (ns.equals(WellKnownNamespaces.XMLNS)) 16 errorMessageId = "xmlns_uri_attribute"; 17 } 18 19 public void visitNsNameExcept(String 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 checkNameClass(NameClass nc) { 41 errorMessageId = null; 42 nc.accept(this); 43 return errorMessageId; 44 } 45 } 46 | Popular Tags |