예제 #1
0
        /// <summary>
        /// Creates a new ResultSequence consisting of the extractable unsignedLong
        /// in the supplied ResultSequence
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence from which the unsignedLong is to be extracted </param>
        /// <returns> New ResultSequence consisting of the 'unsignedLong' supplied </returns>
        /// <exception cref="DynamicError"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            // the function conversion rules apply here too. Get the argument
            // and convert it's string value to a unsignedLong.
            Item aat = arg.first();

            try
            {
                System.Numerics.BigInteger.TryParse(aat.StringValue, out System.Numerics.BigInteger bigInt);

                // doing the range checking
                // min value is 0
                // max value is 18446744073709551615
                System.Numerics.BigInteger min = new System.Numerics.BigInteger(0);
                System.Numerics.BigInteger.TryParse("18446744073709551615", out System.Numerics.BigInteger max);

                if (bigInt.CompareTo(min) < 0 || bigInt.CompareTo(max) > 0)
                {
                    // invalid input
                    throw DynamicError.cant_cast(null);
                }

                return(new XSUnsignedLong(bigInt));
            }
            catch (System.FormatException)
            {
                throw DynamicError.cant_cast(null);
            }
        }
예제 #2
0
        /// <summary>
        /// Creates a new ResultSequence consisting of the extractable 'int' in the
        /// supplied ResultSequence
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence from which the int is to be extracted </param>
        /// <returns> New ResultSequence consisting of the 'int' supplied </returns>
        /// <exception cref="DynamicError"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            // the function conversion rules apply here too. Get the argument
            // and convert it's string value to an int.
            Item aat = arg.first();

            try
            {
                System.Numerics.BigInteger.TryParse(aat.StringValue, out System.Numerics.BigInteger bigInt);

                // doing the range checking
                System.Numerics.BigInteger min = new System.Numerics.BigInteger(-2147483648L);
                System.Numerics.BigInteger max = new System.Numerics.BigInteger(2147483647L);

                if (bigInt.CompareTo(min) < 0 || bigInt.CompareTo(max) > 0)
                {
                    // invalid input
                    DynamicError.throw_type_error();
                }

                return(new XSInt(bigInt));
            }
            catch (System.FormatException)
            {
                throw DynamicError.cant_cast(null);
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                DynamicError.throw_type_error();
            }
            throw new DynamicError("XPST0080", "Can't Cast to NOTATION");
        }
예제 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            AnyAtomicType aat = (AnyAtomicType)arg.first();

            return(new XSUntypedAtomic(aat.StringValue));
        }
예제 #5
0
        /// <summary>
        /// Creation of a result sequence consisting of a URI from a previous result
        /// sequence.
        /// </summary>
        /// <param name="arg">
        ///            previous result sequence </param>
        /// <exception cref="DynamicError"> </exception>
        /// <returns> new result sequence consisting of the URI supplied </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            AnyType aat = (AnyType)arg.first();

            if (!(aat.string_type().Equals("xs:string") || aat.string_type().Equals(XS_ANY_URI) || aat.string_type().Equals("xs:untypedAtomic")))
            {
                throw DynamicError.invalidType();
            }

            return(new XSAnyURI(aat.string_value()));
        }
예제 #6
0
        /// <summary>
        /// Creates a new ResultSequence consisting of the ENTITY within
        /// the supplied ResultSequence.  The specification says that this
        /// is relaxed from the XML Schema requirement.  The ENTITY does
        /// not have to be located or expanded during construction and
        /// evaluation for casting.
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence from which to extract the ENTITY </param>
        /// <returns> New ResultSequence consisting of the ENTITY supplied </returns>
        /// <exception cref="DynamicError"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            AnyAtomicType aat      = (AnyAtomicType)arg.first();
            string        strValue = aat.StringValue;

            if (!isConstraintSatisfied(strValue))
            {
                // invalid input
                DynamicError.throw_type_error();
            }

            return(new XSEntity(strValue));
        }
예제 #7
0
        /// <summary>
        /// Creates a new ResultSequence consisting of the extractable NMTOKEN within
        /// the supplied ResultSequence
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence from which to extract the NMTOKEN </param>
        /// <returns> New ResultSequence consisting of the NMTOKEN supplied </returns>
        /// <exception cref="DynamicError"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            AnyAtomicType aat      = (AnyAtomicType)arg.first();
            string        strValue = aat.StringValue;

            if (!XMLChar.isValidNmtoken(strValue))
            {
                // invalid input
                DynamicError.throw_type_error();
            }

            return(new XSNMTOKEN(strValue));
        }