コード例 #1
0
        /// <summary>
        /// Factory method to get an <c>AtomicType</c> object representing the atomic type with a given QName.
        /// </summary>
        /// <remarks>
        /// It is undefined whether two calls on this method supplying the same QName will return the same
        /// <c>XdmAtomicType</c> object instance.
        /// </remarks>
        /// <param name="qname">The QName of the required type</param>
        /// <returns>An <c>AtomicType</c> object representing this type if it is present in this schema (and is an
        /// atomic type); otherwise, null. </returns>

        public XdmAtomicType GetAtomicType(QName qname)
        {
            JSchemaType type = config.getSchemaType(qname.ToStructuredQName());

            if (type is JBuiltInAtomicType)
            {
                return(XdmAtomicType.BuiltInAtomicType(qname));
            }
            else if (type is JAtomicType)
            {
                return(new XdmAtomicType((JAtomicType)type));
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: Schema.cs プロジェクト: svanteschubert/Saxon-HE
        /// <summary>
		/// Factory method to get an <c>AtomicType</c> object representing the atomic type with a given <c>QName</c>.
        /// </summary>
        /// <remarks>
		/// It is undefined whether two calls on this method supplying the same <c>QName</c> will return the same
        /// <c>XdmAtomicType</c> object instance.
        /// </remarks>
		/// <param name="qname">The <c>QName</c> of the required type</param>
        /// <returns>An <c>AtomicType</c> object representing this type if it is present in this schema (and is an
        /// atomic type); otherwise, null. </returns>

        public XdmAtomicType GetAtomicType(QName qname)
        {
			JSchemaType type = config.getSchemaType(qname.ToStructuredQName());
            if (type is JBuiltInAtomicType)
            {
                return XdmAtomicType.BuiltInAtomicType(qname);
            }
            else if (type is JAtomicType)
            {
                JItemTypeFactory factory = new JItemTypeFactory(processor.JProcessor);
                return new XdmAtomicType(factory.getAtomicType(qname.UnderlyingQName()));
            }
            else
            {
                return null;
            }
        }
コード例 #3
0
        internal static XdmItemType MakeXdmItemType(JItemTypeType type)
        {
            if (type is JAtomicType)
            {
                XdmAtomicType itype = XdmAtomicType.BuiltInAtomicType(QName.FromStructuredQName(((JAtomicType)type).getStructuredQName()));

                return(itype);
            }
            else if (type is JErrorType)
            {
                return(XdmAnyNodeType.Instance);  // TODO: need to represent this properly
            }
            else if (type is JNodeTest)
            {
                if (type is JAnyNodeType)
                {
                    return(XdmAnyNodeType.Instance);
                }
                else
                {
                    int kind = ((JNodeTest)type).getPrimitiveType();
                    return(XdmNodeKind.ForNodeKindTest((JNodeKindTest)JNodeKindTest.makeNodeKindTest(kind)));
                }
            }
            else if (type is JAnyMapType)
            {
                return(XdmAnyMapType.Instance);
            }
            else if (type is JAnyArrayType)
            {
                return(XdmAnyArrayType.Instance);
            }
            else if (type is JAnyItemType)
            {
                return(XdmAnyItemType.Instance);
            }
            else if (type is JFunctionItemType)
            {
                return(XdmAnyFunctionType.Instance);
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
        /// <summary>
        /// Factory method to get an <c>AtomicType</c> object representing the atomic type with a given QName.
        /// </summary>
        /// <remarks>
        /// It is undefined whether two calls on this method supplying the same QName will return the same
        /// <c>XdmAtomicType</c> object instance.
        /// </remarks>
        /// <param name="qname">The QName of the required type</param>
        /// <returns>An <c>AtomicType</c> object representing this type if it is present in this schema (and is an
        /// atomic type); otherwise, null. </returns>

        public XdmAtomicType GetAtomicType(QName qname)
        {
            int         fp   = qname.GetFingerprint(config);
            JSchemaType type = config.getSchemaType(fp);

            if (type is JBuiltInAtomicType)
            {
                return(XdmAtomicType.BuiltInAtomicType(qname));
            }
            else if (type is JAtomicType)
            {
                return(new XdmAtomicType((JAtomicType)type));
            }
            else
            {
                return(null);
            }
        }