0

I feel like I've hit a wall. I'm working on a web application that uses the Saxon library to perform XSLT transformations. The application used to be a console application that simply printed output to the console, but then, we decided that we wanted to control the application from the web.

I wrote a custom TextWriter class that outputs to the web page and used Console.SetOut and Console.SetError to direct my Console output to the web page.

However, Saxon is using some sort of Java compatibility library which doesn't seem to be affected by Console.SetOut, so when I run the application on the web, internal Saxon errors don't appear on the web page.

The short version of my question is: suppose that I call Console.SetOut to change the location that console text is output to and it doesn't work. What then?

4

1 回答 1

0

我很惊讶 Console.SetOut 和 Console.SetError 不起作用。.NET 上的 Saxon 正在使用通过 IKVMC 交叉编译到 .NET 的 OpenJDK 库,我希望输出流的映射能够使这些方法起作用。如果您认为这里存在错误,请在 Saxonica 支持网站 saxonica.plan.io 上报告它,并提供一个重现问题的示例。

但是,重定向 Saxon 错误消息的更好方法可能是注册您自己的 ErrorListener。您不能直接在 .NET Saxon API 中执行此操作,但您可以通过从 XsltTransformer 获取 Controller 并使用 javax.xml.transform.ErrorListener 接口的实现调用其 setErrorListener 方法来执行此操作。

于 2013-10-24T21:13:03.640 回答