未知的格式化异常

本文关键字:异常 格式化 未知 | 更新日期: 2023-09-27 18:01:31

我是XSL新手,正在尝试将以前用于Java应用程序的XSL -stylesheet"移植"到c#(应用程序本身是从旧的Java应用程序移植过来的,因此最终的PDF将生成相同的数据,这也是我正在开发的服务的目标)。当尝试调用REST-Service时,我得到以下错误:

http://imgur.com/edit

加载xsl文件时发生异常:

    [MethodImpl(MethodImplOptions.Synchronized)]
    public static void MakePdf(XmlDocument xslFoDocument, Stream outputStream)
    {
        FonetDriver driver = PdfPrinterDriver.InitFonetDriver();
        driver.Render(xslFoDocument, outputStream);
    }

它所指的代码在这一点上(我得到了很多错误,但这是一个我被困在atm),似乎我的应用程序不识别w3.org/2000/svg。

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"  exclude-result-prefixes="">
http://pastebin.com/g26hKR3q

谁知道是什么原因造成的,我怎么解决它?

我使用的是FO。网络自由。

编辑:完成问题的堆栈跟踪:

System.SystemException was unhandled by user code
HResult=-2146233087
Message=System.SystemException: Unknown formatting object http://www.w3.org/2000/svg^svg
at Fonet.FonetDriver.FireFonetError(String message)
at Fonet.Fo.FOTreeBuilder.StartElement(String uri, String localName, Attributes attlist)
at Fonet.Fo.FOTreeBuilder.Parse(XmlReader reader)
Source=Fonet
StackTrace:
   at Fonet.FonetDriver.FireFonetError(String message)
   at Fonet.Fo.FOTreeBuilder.Parse(XmlReader reader)
   at Fonet.FonetDriver.Render(XmlReader inputReader, Stream outputStream)
   at Fonet.FonetDriver.Render(TextReader inputReader, Stream outputStream)
   at Fonet.FonetDriver.Render(XmlDocument doc, Stream outputStream)
   at MyRESTService.PdfPrinterDriver.MakePdf(XmlDocument xslFoDocument, Stream outputStream) in c:'Users'Jonathan Lind'Documents'Visual Studio 2013'Projects'MyRESTService'MyRESTService'PdfPrinterDriver.cs:line 61
   at MyRESTService.PdfPrinterDriver.MakePdf(XmlDocument xslFoDocument, String outputFileAbsolutePath) in c:'Users'Jonathan Lind'Documents'Visual Studio 2013'Projects'MyRESTService'MyRESTService'PdfPrinterDriver.cs:line 50
   at MyRESTService.ProductRESTService.GetPDFList(String apiquery, String template) in c:'Users'Jonathan Lind'Documents'Visual Studio 2013'Projects'MyRESTService'MyRESTService'ProductRESTService.svc.cs:line 95
   at SyncInvokeGetPDFList(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
InnerException: 

未知的格式化异常

SVG是W3C推荐的一种描述矢量图形的XML格式。我认为Apache top与Java世界中的Apache Batik一起工作,允许您在最终的PDF中插入矢量图形的栅格化。您使用的。net FOP处理器似乎不知道如何处理SVG图形。