1 22 23 package org.xquark.schema; 24 25 40 public abstract class SchemaComponent 41 implements SchemaConstants, SchemaVisitable { 42 private static final String RCSRevision = "$Revision: 1.1 $"; 43 private static final String RCSName = "$Name: $"; 44 45 protected Schema schema; 46 protected String name; 47 48 54 protected SchemaComponent(Schema schema, String name) { 55 this.schema = schema; 56 this.name = name; 57 } 58 59 public void accept(SchemaVisitor visitor) throws SchemaException { 60 visitor.visit(this); 61 } 62 67 public Schema getSchema() { 68 return schema; 69 } 70 71 76 public String getName() { 77 return name; 78 } 79 80 83 public void setName(String name) { this.name = name; } 84 85 90 public String toString() { 91 return name; 92 } 93 94 99 public String getNamespace() { 100 if (schema == null) return null; 101 return schema.getNamespace(); 102 } 103 104 109 public SchemaManager getManager() { 110 if (schema == null) return null; 111 return schema.getManager(); 112 } 113 114 117 118 public boolean hasName(String namespace, String localName) { 119 if (namespace != null && namespace.length() == 0) namespace = null; 120 return localName != null && localName.equals(getName()) && 121 ((namespace == null && getNamespace() == null) || 122 (namespace != null && namespace.equals(getNamespace()))); 123 } 124 125 } 126 | Popular Tags |