/// <summary>
        /// Base-Uri operation.
        /// </summary>
        /// <param name="args">
        ///            Result from the expressions evaluation. </param>
        /// <exception cref="DynamicError">
        ///             Dynamic error. </exception>
        /// <returns> Result of fn:base-uri operation. </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static org.eclipse.wst.xml.xpath2.api.ResultSequence string_to_codepoints(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public static ResultSequence string_to_codepoints(ICollection args)
        {
            ICollection cargs = Function.convert_arguments(args, expected_args());

            var i = cargs.GetEnumerator();

            i.MoveNext();
            ResultSequence arg1 = (ResultSequence)i.Current;

            if (arg1.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            XSString xstr = (XSString)arg1.first();

            CodePointIterator cpi = new StringCodePointIterator(xstr.value());

            ResultBuffer rs = new ResultBuffer();

            for (int codePoint = cpi.current(); codePoint != org.eclipse.wst.xml.xpath2.processor.@internal.utils.CodePointIterator_Fields.DONE; codePoint = cpi.next())
            {
                rs.add(new XSInteger(new System.Numerics.BigInteger(codePoint)));
            }
            return(rs.Sequence);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Join the arguments.
        /// </summary>
        /// <param name="args">
        ///            are joined. </param>
        /// <exception cref="DynamicError">
        ///             Dynamic error. </exception>
        /// <returns> The result of the arguments being joined together. </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static org.eclipse.wst.xml.xpath2.api.ResultSequence string_join(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public static ResultSequence string_join(ICollection args)
        {
            ICollection cargs = Function.convert_arguments(args, expected_args());

            IEnumerator argi = cargs.GetEnumerator();

            argi.MoveNext();
            ResultSequence arg1 = (ResultSequence)argi.Current;

            argi.MoveNext();
            ResultSequence arg2 = (ResultSequence)argi.Current;

            string result    = "";
            string separator = ((XSString)arg2.first()).value();

            StringBuilder buf   = new StringBuilder();
            bool          first = false;

            for (var i = arg1.iterator(); i.MoveNext();)
            {
                if (!first)
                {
                    buf.Append(separator);
                }
                first = false;
                XSString item = (XSString)i.Current;
                buf.Append(item.value());
            }

            result = buf.ToString();
            return(new XSString(result));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Trace operation.
        /// </summary>
        /// <param name="args">
        ///            Result from the expressions evaluation. </param>
        /// <exception cref="DynamicError">
        ///             Dynamic error. </exception>
        /// <returns> Result of fn:trace operation. </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static org.eclipse.wst.xml.xpath2.api.ResultSequence trace(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public static ResultSequence trace(ICollection args)
        {
            // sanity check args
            if (args.Count != 2)
            {
                DynamicError.throw_type_error();
            }

            IEnumerator argsi = args.GetEnumerator();

            argsi.MoveNext();
            ResultSequence arg1 = (ResultSequence)argsi.Current;

            argsi.MoveNext();
            ResultSequence arg2 = (ResultSequence)argsi.Current;

            if (arg2 == null || arg2.size() != 1)
            {
                DynamicError.throw_type_error();
            }

            Item at = arg2.first();

            if (!(at is XSString))
            {
                DynamicError.throw_type_error();
            }

            XSString label = (XSString)at;

            int index = 1;

            for (var i = arg1.iterator(); i.MoveNext(); index++)
            {
                at = (AnyType)i.Current;

                Console.WriteLine(label.value() + " [" + index + "] " + ((AnyType)at).string_type() + ":" + at.StringValue);
            }

            return(arg1);
        }
Ejemplo n.º 4
0
 /// <returns> string value </returns>
 public virtual string @string()
 {
     return(_value.value());
 }