public void Render(TextWriter writer, XQueryRuntimeOptions options) { try { this.Executable.Run(writer, options); } catch (ProcessorException ex) { throw CreateRenderException(ex); } }
public override void Run(TextWriter output, XQueryRuntimeOptions options) { if (options == null) throw new ArgumentNullException("options"); Serializer serializer = this.Processor.ItemFactory.CreateSerializer(options.Serialization); serializer.SetOutputWriter(output); Run(serializer, options); }
protected override void RenderView(ViewContext viewContext, TextWriter writer, object instance) { if (viewContext == null) throw new ArgumentNullException("viewContext"); XQueryPage page = instance as XQueryPage; if (page == null) { throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Compiled view '{0}' must inherit from {1}.", this.ViewPath, typeof(XQueryPage).AssemblyQualifiedName)); } page.SetIntrinsics(HttpContext.Current); page.AddFileDependencies(); var options = new XQueryRuntimeOptions(); options.ContextItem = viewContext.ViewData.Model; foreach (var item in viewContext.ViewData) { options.ExternalVariables[new XmlQualifiedName(item.Key)] = item.Value; } page.Render(viewContext.Writer, options); }
public abstract IEnumerable <XPathItem> Run(XQueryRuntimeOptions options);
public abstract void Run(XmlWriter output, XQueryRuntimeOptions options);
public abstract void Run(Stream output, XQueryRuntimeOptions options);
public override IEnumerable<XPathItem> Run(XQueryRuntimeOptions options) { XQueryEvaluator eval = GetEvaluator(options); XdmValue val; try { val = eval.Evaluate(); } catch (DynamicError ex) { throw new SaxonException(ex); } catch (Exception ex) { throw new SaxonException(ex.Message, ex); } return val.ToXPathItems(); }
public override void Run(XmlWriter output, XQueryRuntimeOptions options) { XmlDestination builder = new TextWriterDestination(output); Run(builder, options); }
void Run(XmlDestination destination, XQueryRuntimeOptions options) { XQueryEvaluator eval = GetEvaluator(options); try { eval.Run(destination); } catch (DynamicError ex) { throw new SaxonException(ex); } catch (Exception ex) { throw new SaxonException(ex.Message, ex); } }
public XQueryResultHandler Query(XQueryRuntimeOptions options) { return new XQueryResultHandler(this.executable, options); }
XQueryEvaluator GetEvaluator(XQueryRuntimeOptions options) { if (options == null) throw new ArgumentNullException("options"); XQueryEvaluator eval = this.executable.Load(); if (options.InputXmlResolver != null) { eval.InputXmlResolver = options.InputXmlResolver; XmlDynamicResolver dynamicResolver = options.InputXmlResolver as XmlDynamicResolver; if (dynamicResolver != null && dynamicResolver.DefaultBaseUri == null) { dynamicResolver.DefaultBaseUri = this.StaticBaseUri; } } if (options.ContextItem != null) { eval.ContextItem = options.ContextItem.ToXdmItem(this.Processor.ItemFactory); } foreach (var pair in options.ExternalVariables) { var qname = new QName(pair.Key); XdmValue xdmValue = pair.Value.ToXdmValue(this.Processor.ItemFactory); eval.SetExternalVariable(qname, xdmValue); } return eval; }
public XQueryResultHandler Query(object input, object parameters) { if (input == null) throw new ArgumentNullException("input"); var options = new XQueryRuntimeOptions { ContextItem = input, InputXmlResolver = new XmlDynamicResolver(this.withCallingAssembly) }; if (parameters != null) { foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(parameters)) { options.ExternalVariables.Add(new XmlQualifiedName(property.Name), property.GetValue(parameters)); } } return Query(options); }
XQueryRuntimeOptions GetRuntimeOptions(XPathItem input, IEnumerable<XPathNavigator> parameters) { var options = new XQueryRuntimeOptions(); if (input != null) { options.ContextItem = input; } if (parameters != null) { foreach (XPathNavigator n in parameters) { options.ExternalVariables.Add(new XmlQualifiedName(n.Name, n.NamespaceURI), n.TypedValue); } } return options; }
public abstract IEnumerable<XPathItem> Run(XQueryRuntimeOptions options);