久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 jar 文件中引用 XSD 架構

Referencing a XSD schema within jar file(在 jar 文件中引用 XSD 架構)
本文介紹了在 jar 文件中引用 XSD 架構的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有兩個架構文件,一個是從另一個導入的.在 Eclipse 架構中執行代碼時找到但從 jar 架構文件中執行代碼時找不到

I have two schema files one is imported from the other. When executing the code in Eclipse schemas are found but when executing the code from jar schema files are not found

這里是代碼

SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(false);

        SchemaFactory schemaFactory = SchemaFactory
                .newInstance("http://www.w3.org/2001/XMLSchema");
        try {
            factory.setSchema(schemaFactory.newSchema(new Source[] {
                    new StreamSource(getClass().getResource("Liso.xsd")
                            .getFile()),
                    new StreamSource(getClass().getResource("LisoXml.xsd")
                            .getFile()) }));
                this.saxParser = factory.newSAXParser();
        } catch (SAXException se) {
            System.out.println("SCHEMA : " + se.getMessage()); // problem in the XSD itself
        }

這是我得到的錯誤

SCHEMA : schema_reference.4: Failed to read schema document 'file:/C:/Tools/lib/LisoTools.jar!/com/xerox/liso/xml/Liso.xsd', because 1) could not find the do
cument; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

謝謝

推薦答案

如果Liso.xsd是在導入LisoXml.xsd,那么定義即可>Liso.xsd 到模式工廠,如下所示.該 API 足夠智能,可以加載導入/包含的架構.

If Liso.xsd is importing LisoXml.xsd, then it is just sufficient to define Liso.xsd to the schema factory as shown below. The api is smart enough the load the imported/included schema(s).

SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema")
Schema compiledSchema = schemaFactory.newSchema(getClass().getClassLoader().getResource("Liso.xsd"))

我驗證這在 1.5 和 1.6 上都有效.在 1.6 上,您可能會遇到 這個問題如果使用 DOM 就好了.

I verified this worked on both 1.5 and 1.6. On 1.6, you might hit in to this issue as well if using DOM.

這篇關于在 jar 文件中引用 XSD 架構的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 精品在线观看一区二区 | 亚洲自拍偷拍欧美 | 亚洲免费在线视频 | 国产一级片av | 久久99久久久久 | 中文字幕在线看人 | 亚洲精品一区中文字幕乱码 | 欧美日韩在线电影 | 99久久精品免费看国产小宝寻花 | 亚洲一区二区三区视频 | 亚洲精品电影 | 日韩不卡一区二区 | 亚洲第一在线 | xx视频在线 | 色毛片 | 天天干天天插 | 日韩欧美在线不卡 | 国产综合久久 | 99热精品在线 | www久久 | 午夜影院在线观看视频 | 国产精品免费在线 | 欧美午夜精品久久久久免费视 | 国产一区二区三区在线 | 性高湖久久久久久久久aaaaa | 青青操av| 国产一区不卡在线观看 | 日本精品视频 | 成人在线观看免费 | 久久综合色综合 | 中文字幕日韩在线 | 免费在线一区二区三区 | 日本视频在线播放 | 久久久久国产 | 金莲网| 羞羞视频免费在线观看 | 欧美韩一区二区 | 99热在线免费| 中文字幕精品一区二区三区精品 | 国产 欧美 日韩 一区 | 成人国产精品久久 |