/// <summary> /// Evaluates the template against the specified value and options. /// </summary> /// <param name="template">A string that represents a valid waterpipe template.</param> /// <param name="value">An object defining the root context.</param> /// <param name="options">Options that alter rendering behaviors.</param> /// <returns></returns> public static XmlDocument EvaluateAsXml(string template, object value, EvaluateOptions options) { CommonHelper.ConfirmNotNull(options, "options"); PipeExecutionException[] exceptions; options.OutputXml = true; XmlNode result = (XmlNode)EvaluationContext.Evaluate(template, new PipeValue(value), options, out exceptions); return(result.OwnerDocument); }
/// <summary> /// Evaluates the template against the specified value and options. /// </summary> /// <param name="template">A string that represents a valid waterpipe template.</param> /// <param name="value">An object defining the root context.</param> /// <param name="options">Options that alter rendering behaviors.</param> /// <returns></returns> public static string Evaluate(string template, object value, EvaluateOptions options) { PipeExecutionException[] exceptions; object result = EvaluationContext.Evaluate(template, new PipeValue(value), options, out exceptions); if (options.OutputXml) { return(((XmlNode)result).OuterXml); } return(result.ToString()); }