2013-02-15 15 views
0

我打算從我的xsl樣式表中驗證輸入xml並輸出xml。我按照這developerworks post來做到這一點。如何在Mule 3.3應用程序中使用模式感知XSLT處理器

當我試圖通過Mule Server運行我的應用程序時,出現以下異常

Error at xsl:import-schema on line 8 of : 
    XTSE1650: To use xsl:import-schema, you need the schema-aware version of Saxon from 
    http://www.saxonica.com/ 
Error at Product on line 23 of : 
    XTSE1660: To perform validation, a schema-aware XSLT processor is needed 
Error on line 23 of : 
    XTTE1512: There is no global element declaration for Product, so strict validation will fail 
  1. 是否有可能在騾子呢?
  2. 這是一種有效的模式驗證方式嗎?

回答

2

XML module for Mule offers a validation filter

<mule-xml:schema-validation-filter 
    schemaLocations="com/myapp/schemas/schema.xsd, com/myapp/schemas/anotherSchema.xsd"/> 

我建議你先嚐試使用它,看它是否符合您的需求。否則,如果您堅持使用您當前的方法,您可能必須將Saxon JAR Mule嵌入到架構感知版本中,或者將架構感知版本發佈到應用程序/庫中並使用class-loader過濾以確保使用正確的版本。

+0

大衛,只是爲了澄清,以確保不會丟失任何東西,因爲我需要驗證輸入和輸出xml,你是否建議在xsl變換器之前和之後放置處理器?你可以評論每種方法的表現嗎? – 2013-02-15 18:28:33

+0

是的,這就是我的建議。不,我不能評論演出,因爲我從來沒有做過這種前/後轉換驗證。在這一天結束時,瓶頸將是XSL-T變壓器,因爲它是Mule中的混合變壓器。 – 2013-02-15 18:34:31

+0

大衛,我試圖使用這個XML模式驗證過濾器作爲''元素的子,並獲取'CheckExclusiveAttributesAndChildren $ CheckExclusiveAttributesAndChildrenException'。更詳細的例外是[here](http://pastebin.com/uqFF3Vzu) – 2013-02-15 19:09:40

相關問題