1 package net.sf.saxon.type; 2 3 import net.sf.saxon.ConversionContext; 4 import net.sf.saxon.expr.Expression; 5 import net.sf.saxon.expr.StaticContext; 6 import net.sf.saxon.om.NamespaceResolver; 7 import net.sf.saxon.om.NodeInfo; 8 import net.sf.saxon.om.SequenceIterator; 9 import net.sf.saxon.om.SingletonIterator; 10 import net.sf.saxon.style.StandardNames; 11 import net.sf.saxon.value.UntypedAtomicValue; 12 import net.sf.saxon.value.Value; 13 import net.sf.saxon.value.Whitespace; 14 15 18 19 public final class AnySimpleType implements SimpleType { 20 21 private static AnySimpleType theInstance = new AnySimpleType(); 22 23 26 private AnySimpleType() { 27 } 28 29 33 34 public AtomicType getCommonAtomicType() { 35 return Type.ANY_ATOMIC_TYPE; 36 } 37 38 42 43 public static AnySimpleType getInstance() { 44 return theInstance; 45 } 46 47 50 public int getValidationStatus() { 51 return VALIDATED; 52 } 53 54 58 59 public SchemaType getBaseType() { 60 return AnyType.getInstance(); 61 } 62 63 68 69 public SchemaType getKnownBaseType() throws IllegalStateException { 70 return getBaseType(); 71 } 72 73 78 79 public boolean isComplexType() { 80 return false; 81 } 82 83 87 88 public boolean isSimpleType() { 89 return true; 90 } 91 92 96 97 public int getFingerprint() { 98 return StandardNames.XS_ANY_SIMPLE_TYPE; 99 } 100 101 106 107 public int getNameCode() { 108 return StandardNames.XS_ANY_SIMPLE_TYPE; 109 } 110 111 115 116 public String getDescription() { 117 return "xs:anySimpleType"; 118 } 119 120 125 126 public String getDisplayName() { 127 return "xs:anySimpleType"; 128 } 129 130 135 136 public boolean isSameType(SchemaType other) { 137 return (other instanceof AnySimpleType); 138 } 139 140 147 148 public SequenceIterator getTypedValue(NodeInfo node) { 149 return SingletonIterator.makeIterator(new UntypedAtomicValue(node.getStringValueCS())); 150 } 151 152 161 162 public Value atomize(NodeInfo node) { 163 return new UntypedAtomicValue(node.getStringValueCS()); 164 } 165 166 174 175 public void isTypeDerivationOK(SchemaType type, int block) throws SchemaException { 176 throw new SchemaException("Cannot derive xs:anySimpleType from another type"); 177 } 178 179 183 184 public boolean isAtomicType() { 185 return false; 186 } 187 188 189 193 public boolean isListType() { 194 return false; 195 } 196 197 201 public boolean isUnionType() { 202 return false; 203 } 204 205 209 public SchemaType getBuiltInBaseType() { 210 return this; 211 } 212 213 225 226 public SequenceIterator getTypedValue(CharSequence value, NamespaceResolver resolver, ConversionContext conversion) { 227 return new UntypedAtomicValue(value).iterate(null); 228 } 229 230 241 public ValidationException validateContent(CharSequence value, NamespaceResolver nsResolver, ConversionContext conversion) { 242 return null; 243 } 244 245 249 public boolean isNamespaceSensitive() { 250 return false; 251 } 252 253 259 260 public int getBlock() { 261 return 0; 262 } 263 264 270 271 public int getDerivationMethod() { 272 return SchemaType.DERIVATION_RESTRICTION; 273 } 274 275 282 283 public boolean allowsDerivation(int derivation) { 284 return true; 285 } 286 287 293 294 public int getWhitespaceAction() { 295 return Whitespace.COLLAPSE; 296 } 297 298 307 308 public void analyzeContentExpression(Expression expression, int kind, StaticContext env) { 309 return; 310 } 311 } 312 313 314 | Popular Tags |