/** * Get the item type of the function item * * @return the function item's type */ public FunctionItemType getFunctionItemType() { AtomicType resultType = BuiltInAtomicType.ANY_ATOMIC; if (memberType.isAtomicType()) { resultType = (AtomicType) memberType; } SequenceType argType = allowEmpty ? SequenceType.OPTIONAL_ATOMIC : SequenceType.SINGLE_ATOMIC; return new SpecificFunctionType( new SequenceType[]{argType}, SequenceType.makeSequenceType(resultType, StaticProperty.ALLOWS_ZERO_OR_MORE)); }
/** * Get the item type of the function item * * @return the function item's type */ public FunctionItemType getFunctionItemType() { AtomicType resultType = BuiltInAtomicType.ANY_ATOMIC; if (memberType.isAtomicType()) { resultType = (AtomicType) memberType; } SequenceType argType = allowEmpty ? SequenceType.OPTIONAL_ATOMIC : SequenceType.SINGLE_ATOMIC; return new SpecificFunctionType( new SequenceType[]{argType}, SequenceType.makeSequenceType(resultType, StaticProperty.ALLOWS_ZERO_OR_MORE)); }
} else if (type instanceof ListType) { SimpleType mem = ((ListType) type).getItemType(); if (mem.isAtomicType()) { return (AtomicType) mem; SimpleType ctype = ((ComplexType) type).getSimpleContentType(); assert ctype != null; if (ctype.isAtomicType()) { return (AtomicType) ctype; } else if (ctype instanceof ListType) { SimpleType mem = ((ListType) ctype).getItemType(); if (mem.isAtomicType()) { return (AtomicType) mem;
} else if (type instanceof ListType) { SimpleType mem = ((ListType) type).getItemType(); if (mem.isAtomicType()) { return (AtomicType) mem; SimpleType ctype = ((ComplexType) type).getSimpleContentType(); assert ctype != null; if (ctype.isAtomicType()) { return (AtomicType) ctype; } else if (ctype instanceof ListType) { SimpleType mem = ((ListType) ctype).getItemType(); if (mem.isAtomicType()) { return (AtomicType) mem;
return false; if (typeCode.isAtomicType()) { if (getConfiguration().getTypeHierarchy().isSubType((AtomicType) typeCode, BuiltInAtomicType.ID)) { return true;
/** * Get the item type of the atomic values that will be produced when an item * of this type is atomized (assuming that atomization succeeds) */ public AtomicType getAtomizedItemType() { SchemaType type = config.getSchemaType(requiredType); if (type.isAtomicType()) { return (AtomicType)type; } else if (type instanceof ListType) { SimpleType mem = ((ListType)type).getItemType(); if (mem.isAtomicType()) { return (AtomicType)mem; } } else if (type instanceof ComplexType && ((ComplexType)type).isSimpleContent()) { SimpleType ctype = ((ComplexType)type).getSimpleContentType(); if (ctype.isAtomicType()) { return (AtomicType)ctype; } else if (ctype instanceof ListType) { SimpleType mem = ((ListType)ctype).getItemType(); if (mem.isAtomicType()) { return (AtomicType)mem; } } } return BuiltInAtomicType.ANY_ATOMIC; }
/** * Get the item type of the atomic values that will be produced when an item * of this type is atomized (assuming that atomization succeeds) */ public AtomicType getAtomizedItemType() { SchemaType type = config.getSchemaType(requiredType); if (type.isAtomicType()) { return (AtomicType)type; } else if (type instanceof ListType) { SimpleType mem = ((ListType)type).getItemType(); if (mem.isAtomicType()) { return (AtomicType)mem; } } else if (type instanceof ComplexType && ((ComplexType)type).isSimpleContent()) { SimpleType ctype = ((ComplexType)type).getSimpleContentType(); if (ctype.isAtomicType()) { return (AtomicType)ctype; } else if (ctype instanceof ListType) { SimpleType mem = ((ListType)ctype).getItemType(); if (mem.isAtomicType()) { return (AtomicType)mem; } } } return BuiltInAtomicType.ANY_ATOMIC; }
return false; if (typeCode.isAtomicType()) { if (getConfiguration().getTypeHierarchy().isSubType((AtomicType) typeCode, BuiltInAtomicType.ID)) { return true;
/** * Check whether the content of an attribute is namespace-sensitive * * * @param type the type annotation of the node * @param nodeNr the the node number of the elemente * @throws XPathException if an error occurs */ private void checkNotNamespaceSensitiveAttribute(SimpleType type, int nodeNr) throws XPathException { if (type.isNamespaceSensitive()) { if (type.isAtomicType()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } else { // For a union or list type, we need to check whether the actual value is namespace-sensitive AtomicSequence value = tree.getTypedValueOfAttribute(null, nodeNr); for (AtomicValue val : value) { if (val.getPrimitiveType().isNamespaceSensitive()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } } } } }
/** * Check whether the content of an attribute is namespace-sensitive * * * @param type the type annotation of the node * @param nodeNr the the node number of the elemente * @throws XPathException if an error occurs */ private void checkNotNamespaceSensitiveAttribute(SimpleType type, int nodeNr) throws XPathException { if (type.isNamespaceSensitive()) { if (type.isAtomicType()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } else { // For a union or list type, we need to check whether the actual value is namespace-sensitive AtomicSequence value = tree.getTypedValueOfAttribute(null, nodeNr); for (AtomicValue val : value) { if (val.getPrimitiveType().isNamespaceSensitive()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } } } } }
/** * Test whether a type annotation code represents the type xs:ID or one of its subtypes * @param typeCode the type annotation to be tested * @return true if the type annotation represents an xs:ID */ public boolean isIdCode(int typeCode) { typeCode &= NamePool.FP_MASK; if (typeCode == StandardNames.XS_ID) { return true; } else if (typeCode < 1024) { // No other built-in type is an ID return false; } else { SchemaType type = config.getSchemaType(typeCode); if (type == null) { return false; // this shouldn't happen, but there's no need to crash right here } if (type.isAtomicType()) { return isSubType((AtomicType)type, BuiltInAtomicType.ID); } if (type instanceof ComplexType && ((ComplexType)type).isSimpleContent()) { SimpleType contentType = ((ComplexType)type).getSimpleContentType(); if (contentType.isAtomicType()) { return isSubType((AtomicType)contentType, BuiltInAtomicType.ID); } } return false; } }
/** * Test whether a type annotation code represents the type xs:ID or one of its subtypes * @param typeCode the type annotation to be tested * @return true if the type annotation represents an xs:ID */ public boolean isIdCode(int typeCode) { typeCode &= NamePool.FP_MASK; if (typeCode == StandardNames.XS_ID) { return true; } else if (typeCode < 1024) { // No other built-in type is an ID return false; } else { SchemaType type = config.getSchemaType(typeCode); if (type == null) { return false; // this shouldn't happen, but there's no need to crash right here } if (type.isAtomicType()) { return isSubType((AtomicType)type, BuiltInAtomicType.ID); } if (type instanceof ComplexType && ((ComplexType)type).isSimpleContent()) { SimpleType contentType = ((ComplexType)type).getSimpleContentType(); if (contentType.isAtomicType()) { return isSubType((AtomicType)contentType, BuiltInAtomicType.ID); } } return false; } }
} else if (type instanceof ListType) { SimpleType itemType = ((ListType)type).getItemType(); return itemType.isAtomicType() && th.isSubType((AtomicType)itemType, BuiltInAtomicType.IDREF);
return itemType.isAtomicType() && th.isSubType((AtomicType)itemType, BuiltInAtomicType.ID);
} else if (type instanceof ListType) { SimpleType itemType = ((ListType)type).getItemType(); return itemType.isAtomicType() && th.isSubType((AtomicType)itemType, BuiltInAtomicType.IDREF);
if (type.isAtomicType()) { if (((AtomicType) type).isAbstract()) { reasons.add("Abstract type used in constructor function: {" + uri + '}' + localName);
if (contentType.isAtomicType()) { return isSubType((AtomicType)contentType, BuiltInAtomicType.IDREF); } else if (contentType instanceof ListType) {
if (type.isAtomicType()) { if (((AtomicType) type).isAbstract()) { reasons.add("Abstract type used in constructor function: {" + uri + '}' + localName);
if (contentType.isAtomicType()) { return isSubType((AtomicType)contentType, BuiltInAtomicType.IDREF); } else if (contentType instanceof ListType) {