Пример #1
0
        /// <summary>
        /// Execute an updating query.
        /// </summary>
        /// <returns>An array containing the root nodes of documents that have been
        /// updated by the query.</returns>
        /// <exception cref="DynamicError">Throws a DynamicError if any run-time failure
        /// occurs while evaluating the expression, or if the expression is not an
        /// updating query.</exception>

        public XdmNode[] RunUpdate()
        {
            if (!exp.isUpdateQuery())
            {
                throw new DynamicError("Not an updating query");
            }
            try
            {
                java.util.Set updatedDocs = exp.runUpdate(context);
                XdmNode[]     result      = new XdmNode[updatedDocs.size()];
                int           i           = 0;
                for (java.util.Iterator iter = updatedDocs.iterator(); iter.hasNext();)
                {
                    result[i++] = (XdmNode)XdmValue.Wrap((JNodeInfo)iter.next());
                }
                return(result);
            }
            catch (JXPathException err)
            {
                throw new DynamicError(err);
            }
        }