1 package net.sf.saxon.dom; 2 3 import net.sf.saxon.type.SchemaType; 4 import net.sf.saxon.type.AnyType; 5 import net.sf.saxon.Configuration; 6 import org.w3c.dom.TypeInfo ; 7 8 12 13 public class TypeInfoImpl implements TypeInfo { 14 15 private Configuration config; 16 private SchemaType schemaType; 17 18 21 22 public TypeInfoImpl(Configuration config, SchemaType type) { 23 this.config = config; 24 this.schemaType = type; 25 } 26 27 31 32 public String getTypeName() { 33 return config.getNamePool().getLocalName(schemaType.getNameCode()); 34 } 35 36 40 41 public String getTypeNamespace() { 42 return config.getNamePool().getURI(schemaType.getNameCode()); 43 } 44 45 55 56 public boolean isDerivedFrom(String typeNamespaceArg, 57 String typeNameArg, 58 int derivationMethod) throws IllegalStateException { 59 SchemaType base = schemaType.getBaseType(); 60 int fingerprint = config.getNamePool().allocate("", typeNamespaceArg, typeNameArg); 61 if (derivationMethod==0 || (derivationMethod & schemaType.getDerivationMethod()) != 0) { 62 if (base.getFingerprint() == fingerprint) { 63 return true; 64 } else if (base instanceof AnyType) { 65 return false; 66 } else { 67 return new TypeInfoImpl(config, base).isDerivedFrom(typeNamespaceArg, typeNameArg, derivationMethod); 68 } 69 } 70 return false; 71 } 74 75 } 76 77 | Popular Tags |