1 package net.sf.saxon.type; 2 3 import net.sf.saxon.expr.Expression; 4 import net.sf.saxon.expr.StaticContext; 5 import net.sf.saxon.expr.StaticProperty; 6 import net.sf.saxon.om.NodeInfo; 7 import net.sf.saxon.om.SequenceIterator; 8 import net.sf.saxon.om.SingletonIterator; 9 import net.sf.saxon.style.StandardNames; 10 import net.sf.saxon.value.UntypedAtomicValue; 11 import net.sf.saxon.value.Value; 12 13 import java.io.Serializable ; 14 15 19 20 public final class Untyped implements ComplexType, Serializable { 21 22 25 public int getValidationStatus() { 26 return VALIDATED; 27 } 28 29 35 36 public int getBlock() { 37 return 0; 38 } 39 40 46 47 public int getDerivationMethod() { 48 return 0; 49 } 50 51 58 59 public boolean allowsDerivation(int derivation) { 60 return false; 61 } 62 63 69 70 public void isTypeDerivationOK(SchemaType type, int block) { 71 72 } 73 74 private static Untyped theInstance = new Untyped(); 75 76 79 private Untyped() {} 80 81 86 87 public int getFingerprint() { 88 return StandardNames.XDT_UNTYPED; 89 } 90 91 96 97 public int getNameCode() { 98 return StandardNames.XDT_UNTYPED; 99 } 100 101 106 107 public String getDisplayName() { 108 return "xdt:untyped"; 109 } 110 111 116 117 public boolean isComplexType() { 118 return true; 119 } 120 121 129 130 public SchemaType getKnownBaseType() throws IllegalStateException { 131 return AnyType.getInstance(); 132 } 133 134 139 140 public boolean isSameType(SchemaType other) { 141 return (other instanceof Untyped); 142 } 143 144 150 151 public SchemaType getBaseType() { 152 return AnyType.getInstance(); 153 } 154 155 156 160 161 public static Untyped getInstance() { 162 return theInstance; 163 } 164 165 169 170 public boolean isAbstract() { 171 return false; 172 } 173 174 178 179 public boolean isSimpleType() { 180 return false; 181 } 182 183 187 public boolean isComplexContent() { 188 return true; 189 } 190 191 195 196 public boolean isSimpleContent() { 197 return false; 198 } 199 200 205 206 public boolean isAllContent() { 207 return false; 208 } 209 210 215 216 public SimpleType getSimpleContentType() { 217 return null; 218 } 219 220 224 public boolean isRestricted() { 225 return true; 226 } 227 228 232 233 public boolean isEmptyContent() { 234 return false; 235 } 236 237 241 242 public boolean isEmptiable() { 243 return true; 244 } 245 246 250 251 public boolean isMixedContent() { 252 return true; 253 } 254 255 259 260 public String getDescription() { 261 return "xdt:untyped"; 262 } 263 264 274 275 public void analyzeContentExpression(Expression expression, int kind, StaticContext env) { 276 return; 277 } 278 279 285 286 public SequenceIterator getTypedValue(NodeInfo node) { 287 return SingletonIterator.makeIterator(new UntypedAtomicValue(node.getStringValueCS())); 288 } 289 290 299 300 public Value atomize(NodeInfo node) { 301 return new UntypedAtomicValue(node.getStringValue()); 302 } 303 304 311 312 public String subsumes(ComplexType sub) { 313 return null; 314 } 315 316 325 326 public SchemaType getElementParticleType(int fingerprint) { 327 return this; 328 } 329 330 340 341 public int getElementParticleCardinality(int fingerprint) { 342 return StaticProperty.ALLOWS_ZERO_OR_MORE; 343 } 344 345 354 355 public SchemaType getAttributeUseType(int fingerprint) { 356 return BuiltInSchemaFactory.getSchemaType(StandardNames.XDT_UNTYPED_ATOMIC); 357 } 358 } 359 360 361 | Popular Tags |