/// <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.GetReceiver(context.getConfiguration().makePipelineConfiguration()), destination.GetOutputProperties()); } catch (JXPathException err) { throw new DynamicError(err); } destination.Close(); }
/// <summary> /// Run the validation of the supplied source document, optionally /// writing the validated document to the supplied destination. /// </summary> public void Run() { JAugmentedSource aug = JAugmentedSource.makeAugmentedSource(source); aug.setSchemaValidationMode(lax ? JValidation.LAX : JValidation.STRICT); JReceiver receiver; JPipelineConfiguration pipe = config.makePipelineConfiguration(); if (destination == null) { receiver = new JSink(pipe); } else if (destination is Serializer) { receiver = ((Serializer)destination).GetReceiver(config); } else { Result result = destination.GetReceiver(pipe); if (result is JReceiver) { receiver = (JReceiver)result; } else { throw new ArgumentException("Unknown type of destination"); } } pipe.setUseXsiSchemaLocation(useXsiSchemaLocation); receiver.setPipelineConfiguration(pipe); JParseOptions parseOptions = null; if (errorList != null) { invalidityHandler = new net.sf.saxon.lib.InvalidityHandlerWrappingErrorListener(new ErrorGatherer(errorList)); } parseOptions = new JParseOptions(); parseOptions.setInvalidityHandler(invalidityHandler); JSender.send(aug, receiver, parseOptions); }
/// <summary> /// Run the validation of the supplied source document, optionally /// writing the validated document to the supplied destination. /// </summary> public void Run() { JAugmentedSource aug = JAugmentedSource.makeAugmentedSource(source); aug.setSchemaValidationMode(lax ? JValidation.LAX : JValidation.STRICT); JReceiver receiver; PipelineConfiguration pipe = config.makePipelineConfiguration(); if (destination == null) { receiver = new Sink(pipe); } else if (destination is Serializer) { receiver = ((Serializer)destination).GetReceiver(config); } else { Result result = destination.GetReceiver(pipe); if (result is JReceiver) { receiver = (JReceiver)result; } else { throw new ArgumentException("Unknown type of destination"); } } pipe.setUseXsiSchemaLocation(useXsiSchemaLocation); receiver.setPipelineConfiguration(pipe); if (errorList != null) { pipe.setErrorListener(new ErrorGatherer(errorList)); } Sender.send(aug, receiver, null); }