/// <summary> /// Run the transformation, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the stylesheet. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a DynamicError if the transformation /// fails.</exception> public void Run(XmlDestination destination) { try { controller.setOutputProperties(destination.GetOutputProperties()); if (streamSource != null) { controller.transform(streamSource, destination.GetResult()); } else if (initialContextNode != null) { JDocumentInfo doc = initialContextNode.getDocumentRoot(); controller.registerDocument(doc, doc.getBaseURI()); controller.transform(initialContextNode, destination.GetResult()); } else { controller.transform(null, destination.GetResult()); } destination.Close(); } catch (javax.xml.transform.TransformerException err) { throw new DynamicError(err); } }
/// <summary>Setup Validation Reporting feature which saves the validation errors in an XML file</summary> /// <param name="destination"> destination where XML will be sent</param> public void SetValidityReporting(XmlDestination destination) { JInvalidityReportGenerator reporter = processor.Implementation.createValidityReporter(); reporter.setReceiver(destination.GetReceiver(processor.Implementation.makePipelineConfiguration())); this.invalidityHandler = reporter; }
/// <summary> /// Evaluate the query, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the query. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a DynamicError if any run-time failure /// occurs while evaluating the expression.</exception> public void Run(XmlDestination destination) { try { exp.run(context, destination.GetResult(), destination.GetOutputProperties()); } catch (JXPathException err) { throw new DynamicError(err); } destination.Close(); }
/// <summary> /// Evaluate the query, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the query. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a DynamicError if any run-time failure /// occurs while evaluating the expression.</exception> public void Run(XmlDestination destination) { try { exp.run(context, destination.GetReceiver(context.getConfiguration().makePipelineConfiguration()), destination.GetOutputProperties()); } catch (JXPathException err) { throw new DynamicError(err); } destination.Close(); }
/// <summary> /// Evaluate the query, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the query. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a <c>DynamicError</c> if any run-time failure /// occurs while evaluating the expression.</exception> public void Run(XmlDestination destination) { try { evaluator.setDestination(destination.GetUnderlyingDestination()); evaluator.run(); } catch (JSaxonApiException err) { throw new DynamicError(err); } }
void Run(XmlDestination destination, XsltRuntimeOptions options) { if (options == null) throw new ArgumentNullException("options"); XsltTransformer transformer = executable.Load(); transformer.RecoveryPolicy = RecoveryPolicy.DoNotRecover; if (options.InputXmlResolver != null) transformer.InputXmlResolver = options.InputXmlResolver; // XsltTransformer.BaseOutputUri doesn't accept null if (options.BaseOutputUri != null) transformer.BaseOutputUri = options.BaseOutputUri; // TODO: Bug in Saxon 9.3 //else if (this.StaticBaseUri != null && this.StaticBaseUri.IsFile) // transformer.BaseOutputUri = new Uri(Path.GetDirectoryName(this.StaticBaseUri.LocalPath), UriKind.Absolute); try { if (options.InitialTemplate != null) transformer.InitialTemplate = new QName(options.InitialTemplate); } catch (DynamicError err) { throw new SaxonException(err); } if (options.InitialMode != null) transformer.InitialMode = new QName(options.InitialMode); if (options.InitialContextNode != null) transformer.InitialContextNode = options.InitialContextNode.ToXdmNode(this.Processor.ItemFactory); transformer.MessageListener = new SaxonMessageListener(); foreach (var pair in options.Parameters) { QName qname = new QName(pair.Key); XdmValue xdmValue = pair.Value.ToXdmValue(this.Processor.ItemFactory); transformer.SetParameter(qname, xdmValue); } try { transformer.Run(destination); } catch (DynamicError ex) { throw new SaxonException(ex); } catch (Exception ex) { throw new SaxonException(ex.Message, ex); } }
public JResult resolve(String href, String baseString) { Uri baseUri; try { baseUri = new Uri(baseString); } catch (System.UriFormatException err) { throw new JTransformerException("Invalid base output URI " + baseString, err); } XmlDestination destination = handler.HandleResultDocument(href, baseUri); JResult result = destination.GetResult(); resultMap.Add(result, destination); return(destination.GetResult()); }
/// <summary> /// Copy an XdmValue to an XmlDestination /// </summary> /// <remarks> /// This method can be used to copy any kind of <c>XdmValue</c> to any kind /// of <c>XdmDestination</c>. The supplied <c>XdmValue</c> is first converted /// to an XML document according to the rules of the XSLT/XQuery serialization /// specification (for example, if the <c>XdmValue</c> is a sequence of atomic /// values, they will be turned in a text node in which the values are converted /// to strings and separated by single spaces). The resulting document is then /// written to the supplied <c>XmlDestination</c>.</remarks> /// <param name="sequence">The value to be written</param> /// <param name="destination">The destination to which the value should be written</param> /// public void WriteXdmValue(XdmValue sequence, XmlDestination destination) { JResult result = destination.GetResult(); JReceiver r = config.getSerializerFactory().getReceiver(result, config.makePipelineConfiguration(), new JProperties()); r = new JNamespaceReducer(r); JTreeReceiver tree = new JTreeReceiver(r); tree.open(); tree.startDocument(0); foreach (XdmItem it in sequence) { tree.append((Item)it.Unwrap(), 0, JNodeInfo.__Fields.ALL_NAMESPACES); } tree.endDocument(); tree.close(); }
/// <summary> /// Run the transformation, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the stylesheet. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a DynamicError if the transformation /// fails.</exception> public void Run(XmlDestination destination) { // TODO: This isn't an ideal way of running the stylesheet if it invokes xsl:strip-space: it's better to do the // whitespace stripping while building the tree. try { controller.setOutputProperties(destination.GetOutputProperties()); if (initialContextNode != null) { JDocumentInfo doc = initialContextNode.getDocumentRoot(); controller.registerDocument(doc, doc.getBaseURI()); } controller.transform(initialContextNode, destination.GetResult()); destination.Close(); } catch (javax.xml.transform.TransformerException err) { throw new DynamicError(err); } }
/// <summary> /// Copy an XdmValue to an XmlDestination /// </summary> /// <remarks> /// This method can be used to copy any kind of <c>XdmValue</c> to any kind /// of <c>XdmDestination</c>. The supplied <c>XdmValue</c> is first converted /// to an XML document according to the rules of the XSLT/XQuery serialization /// specification (for example, if the <c>XdmValue</c> is a sequence of atomic /// values, they will be turned in a text node in which the values are converted /// to strings and separated by single spaces). The resulting document is then /// written to the supplied <c>XmlDestination</c>.</remarks> /// <param name="sequence">The value to be written</param> /// <param name="destination">The destination to which the value should be written</param> /// public void WriteXdmValue(XdmValue sequence, XmlDestination destination) { try { JPipelineConfiguration pipe = config.makePipelineConfiguration(); JResult result = destination.GetResult(pipe); JReceiver r = config.getSerializerFactory().getReceiver(result, pipe, destination.GetOutputProperties()); r = new JNamespaceReducer(r); JTreeReceiver tree = new JTreeReceiver(r); tree.open(); tree.startDocument(0); foreach (XdmItem it in sequence) { tree.append((Item)it.Unwrap(), 0, JNodeInfo.__Fields.ALL_NAMESPACES); } tree.endDocument(); tree.close(); } catch (JXPathException err) { throw new DynamicError(err); } }
public void close(JResult result) { XmlDestination destination = (XmlDestination)resultMap[result]; destination.Close(); }
/// <summary> /// Run the transformation, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the stylesheet. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a DynamicError if the transformation /// fails.</exception> public void Run(XmlDestination destination) { try { controller.setOutputProperties(destination.GetOutputProperties()); if (streamSource != null) { controller.transform(streamSource, destination.GetResult(controller.makePipelineConfiguration())); } else if (initialContextNode != null) { JDocumentInfo doc = initialContextNode.getDocumentRoot(); controller.registerDocument(doc, (doc.getBaseURI()==null ? null : new JDocumentURI(doc.getBaseURI()))); controller.transform(initialContextNode, destination.GetResult(controller.makePipelineConfiguration())); } else { controller.transform(null, destination.GetResult(controller.makePipelineConfiguration())); } destination.Close(); } catch (javax.xml.transform.TransformerException err) { throw new DynamicError(err); } }
/// <summary> /// Evaluate the query, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the query. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a DynamicError if any run-time failure /// occurs while evaluating the expression.</exception> public void Run(XmlDestination destination) { try { exp.run(context, destination.GetResult(context.getConfiguration().makePipelineConfiguration()), destination.GetOutputProperties()); } catch (JXPathException err) { throw new DynamicError(err); } destination.Close(); }
/// <summary> /// Supply the destination to hold the validated document. If no destination /// is supplied, the validated document is discarded. /// </summary> /// <remarks> /// The destination differs from the source in that (a) default values of missing /// elements and attributes are supplied, and (b) the typed values of elements and /// attributes are available. However, typed values can only be accessed if the result /// is represented using the XDM data model, that is, if the destination is supplied /// as an XdmDestination. /// </remarks> public void SetDestination(XmlDestination destination) { this.destination = destination; }
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); } }
/// <summary> /// Supply the destination to hold the validated document. If no destination /// is supplied, the validated document is discarded. /// </summary> /// <remarks> /// The destination differs from the source in that (a) default values of missing /// elements and attributes are supplied, and (b) the typed values of elements and /// attributes are available. However, typed values can only be accessed if the result /// is represented using the XDM data model, that is, if the destination is supplied /// as an <c>XdmDestination</c>. /// </remarks> /// <param name="destination"> /// The destination to hold the validated document. /// </param> public void SetDestination(XmlDestination destination) { schemaValidator.setDestination(destination.GetUnderlyingDestination()); }
/// <summary>Set the validation reporting feature, which saves the validation errors in an XML file</summary> /// <param name="destination"> destination where XML will be sent</param> public void SetValidityReporting(XmlDestination destination) { schemaValidator.setValidityReporting(destination.GetUnderlyingDestination()); }
internal AbstractDestination(Xslt30Transformer xslt30Transformer, XmlDestination destination) { this.xslt30Transformer = xslt30Transformer; this.destination = destination; }
/// <summary> /// Supply the destination to hold the validated document. If no destination /// is supplied, the validated document is discarded. /// </summary> /// <remarks> /// The destination differs from the source in that (a) default values of missing /// elements and attributes are supplied, and (b) the typed values of elements and /// attributes are available. However, typed values can only be accessed if the result /// is represented using the XDM data model, that is, if the destination is supplied /// as an XdmDestination. /// </remarks> /// <param name="destination"> /// The destination to hold the validated document. /// </param> public void SetDestination(XmlDestination destination) { this.destination = destination; }
/// <summary> /// Output an XML representation of the compiled code of the stylesheet, for purposes of /// diagnostics and instrumentation /// </summary> /// <param name="destination">The destination for the diagnostic output</param> public void Explain(XmlDestination destination) { JConfiguration config = pss.getConfiguration(); JResult result = destination.GetResult(config.makePipelineConfiguration()); JProperties properties = new JProperties(); properties.setProperty("indent", "yes"); properties.setProperty("{http://saxon.sf.net/}indent-spaces", "2"); JReceiver receiver = config.getSerializerFactory().getReceiver( result, config.makePipelineConfiguration(), properties); JExpressionPresenter presenter = new JExpressionPresenter(config, receiver); pss.explain(presenter); }
/// <summary> /// Run the transformation, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the stylesheet. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a DynamicError if the transformation /// fails.</exception> public void Run(XmlDestination destination) { try { controller.setOutputProperties(destination.GetOutputProperties()); if (initialContextNode != null) { JDocumentInfo doc = initialContextNode.getDocumentRoot(); controller.registerDocument(doc, doc.getBaseURI()); } controller.transformDocument(initialContextNode, destination.GetResult()); destination.Close(); } catch (javax.xml.transform.TransformerException err) { throw new DynamicError(err); } }