Package net.sf.saxon.type

Examples of net.sf.saxon.type.SchemaType


        Configuration config = pipe.getConfiguration();
        int schemaValidation = options.getSchemaValidationMode();
        if ((schemaValidation & Validation.VALIDATION_MODE_MASK) != Validation.PRESERVE) {
            // Add a document validator to the pipeline
            int stripSpace = options.getStripSpace();
            SchemaType topLevelType = options.getTopLevelType();
            StructuredQName topLevelElement = options.getTopLevelElement();
            int topLevelElementCode = -1;
            if (topLevelElement != null) {
                topLevelElementCode = config.getNamePool().allocate(
                        topLevelElement.getPrefix(), topLevelElement.getNamespaceURI(), topLevelElement.getLocalName());
View Full Code Here


      receiver.endElement();
    }
    }

    private void checkNotNamespaceSensitive(Configuration config, final int typeCode) throws XPathException {
        SchemaType type = config.getSchemaType(typeCode & NamePool.FP_MASK);
        if (type instanceof SimpleType && ((SimpleType)type).isNamespaceSensitive()) {
            throw new CopyNamespaceSensitiveException(
                    "Cannot copy QName or NOTATION values without copying namespaces");
//            err.setErrorCode((language == Configuration.XSLT ? "XTTE0950" : "XQTY0086"));
//            throw err;
View Full Code Here

                    }
                    if (ann2 == -1) {
                        // defensive programming
                        ann2 = StandardNames.XS_UNTYPED;
                    }
                    final SchemaType type1 = config.getSchemaType(ann1);
                    final SchemaType type2 = config.getSchemaType(ann2);
                    final boolean isSimple1 = type1.isSimpleType() || ((ComplexType)type1).isSimpleContent();
                    final boolean isSimple2 = type2.isSimpleType() || ((ComplexType)type2).isSimpleContent();
                    if (isSimple1 != isSimple2) {
                        explain(config, "one element has a simple type, the other does not", flags);
                        return false;
                    }
                    if (isSimple1 && isSimple2) {
View Full Code Here

        int fingerprint = config.getNamePool().getFingerprint(uri, local);
        if (fingerprint == -1) {
            return null;
        } else {
            SchemaType st = config.getSchemaType(fingerprint);
            if (st != null && st.isAtomicType()) {
                return new SequenceType[] {
                        SequenceType.makeSequenceType((AtomicType)st, StaticProperty.ALLOWS_ZERO_OR_ONE),
                        SequenceType.OPTIONAL_ATOMIC
                };
            } else {
View Full Code Here

        // Now see if it's a constructor function for a user-defined type

        if (arguments.length == 1) {
            int fp = config.getNamePool().getFingerprint(uri, localName);
            if (fp != -1) {
                SchemaType st = config.getSchemaType(fp);
                if (st != null && st.isAtomicType()) {
                    return new CastExpression(arguments[0], (AtomicType)st, true);
                }
            }
        }
View Full Code Here

                    (type instanceof BuiltInAtomicType ? ((BuiltInAtomicType)type) : (BuiltInAtomicType)type.getBuiltInBaseType());
            while (true) {
                if (builtIn.isSameType(underlyingType)) {
                    return true;
                }
                SchemaType base = builtIn.getBaseType();
                if (!(base instanceof BuiltInAtomicType)) {
                    return false;
                }
                builtIn = (BuiltInAtomicType)base;
            }
View Full Code Here

                nonIDs = new IntHashSet(20);
            }
            if (nonIDs.contains(typeCode)) {
                return false;
            }
            SchemaType type = getConfiguration().getSchemaType(typeCode);
            if (type.isAtomicType()) {
                if (getConfiguration().getTypeHierarchy().isSubType((AtomicType)type, BuiltInAtomicType.ID)) {
                    return true;
                } else {
                    nonIDs.add(typeCode);
                    return false;
View Full Code Here

        } else if (elementStrip == ALWAYS_STRIP) {
            preserve |= ALWAYS_STRIP;
        }
        if (preserve == 0 && typeCode != -1 && typeCode != StandardNames.XS_UNTYPED) {
            // if the element has simple content, whitespace stripping is disabled
            SchemaType type = getConfiguration().getSchemaType(typeCode);
            if (type.isSimpleType() || ((ComplexType)type).isSimpleContent()) {
                preserve |= CANNOT_STRIP;
            }
        }

        // put "preserve" value on top of stack
View Full Code Here

        int annotation = getTypeAnnotation();
        if (annotation==-1) {
            return SingletonIterator.makeIterator(
                                new UntypedAtomicValue(getStringValue()));
        } else {
            SchemaType stype = config.getSchemaType(annotation);
            if (stype == null) {
                String typeName = getNamePool().getDisplayName(annotation);
                throw new DynamicError("Unknown type annotation " +
                        Err.wrap(typeName) + " in document instance");
            } else {
                return stype.getTypedValue(this);
            }
        }
    }
View Full Code Here

    public SequenceIterator getTypedValue(Configuration config) throws XPathException {
        if (typeAnnotation == -1) {
            return SingletonIterator.makeIterator(
                    new UntypedAtomicValue(stringValue));
        } else {
            SchemaType stype = config.getSchemaType(typeAnnotation);
            if (stype == null) {
                String typeName = namePool.getDisplayName(typeAnnotation);
                throw new IllegalStateException("Unknown type annotation " +
                        Err.wrap(typeName) + " in standalone node");
            } else {
                return stype.getTypedValue(this);
            }
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.type.SchemaType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.