Ejemplo n.º 1
0
        /// <summary>
        /// Document-Uri operation.
        /// </summary>
        /// <param name="args">
        ///            Result from the expressions evaluation. </param>
        /// <exception cref="DynamicError">
        ///             Dynamic error. </exception>
        /// <returns> Result of fn:document-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 document_uri(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public static ResultSequence document_uri(ICollection args)
        {
            ICollection cargs = Function.convert_arguments(args, expected_args());
            var         i     = cargs.GetEnumerator();

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

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

            NodeType nt = (NodeType)arg1.first();

            if (!(nt is DocType))
            {
                return(ResultBuffer.EMPTY);
            }

            DocType dt          = (DocType)nt;
            string  documentURI = dt.value().DocumentURI;

            if (!string.ReferenceEquals(documentURI, null))
            {
                XSAnyURI docUri = new XSAnyURI(documentURI);
                return(docUri);
            }
            return(ResultBuffer.EMPTY);
        }