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

如何通過相對(duì)路徑引用本地 XSD 文件

How to Reference Local XSD File By Relative Path(如何通過相對(duì)路徑引用本地 XSD 文件)
本文介紹了如何通過相對(duì)路徑引用本地 XSD 文件的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

這是 如何配置 Eclipse 以使用的后續(xù)內(nèi)容`ehcache` 并且在 如何正確引用本地 XML Schema 文件?

由于不再托管 xsd 文件,我從存檔中下載了它的副本.我已將該文件放在我的資源目錄中,并希望在我的 xsi:schemaLocation 中從我的項(xiàng)目的相對(duì)路徑中引用它.我們有 windows 和 mac 開發(fā)人員,所以像 file:///c:/project/foo 這樣的絕對(duì)路徑約定是行不通的.

Since the xsd file is not longer being hosted, I downloaded a copy of it from the archive. I've put the file in my resource directory and would like to reference it in my xsi:schemaLocation from a relative path of my project. We have both windows and mac developers, so an absolute path convention like file:///c:/project/foo won't work.

相對(duì)路徑的另一種替代方法是,如果有一種方法可以引用 windows 和 mac 的系統(tǒng)屬性,那么我可以執(zhí)行 2 個(gè)條目,例如 file:///$HOME/workspace/foo.

Another alternative to relative path would be if there is a way to reference system properties for both windows and mac, then I could do 2 entries like file:///$HOME/workspace/foo.

我的 Mac 上的項(xiàng)目存在于 ~/workspace/foo 中,$HOME 的 echo 給出了我的主路徑.

My project on my mac exists in ~/workspace/foo and echo of $HOME gives my home path.

我的spring-cache.xml存在于./src/main/webapp/WEB-INF/spring/

我的 ehcache-spring-1.2.xsd 存在于 ./src/main/resources/

以下是我嘗試過但沒有成功的一些:

The following are some that I've tried without success:

        file:///$HOME/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd
        file:///./src/main/resources/ehcache-spring-1.2.xsd             
        file:///../../../../resources/ehcache-spring-1.2.xsd
        file:///../../../../resources/ehcache-spring-1.2.xsd
        ../../../../resources/ehcache-spring-1.2.xsd
        file://../../../../resources/ehcache-spring-1.2.xsd
        file://$HOME/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd
        file://./src/main/resources/ehcache-spring-1.2.xsd              
        file://../../../../resources/ehcache-spring-1.2.xsd

我似乎也有問題讓它從絕對(duì)路徑引用文件,所以也許有不同的方式來引用 mac 上的文件?例如以下方法無效:

I also seem to have issues getting it to reference the file from absolute path too, so perhaps there is a different way to reference the file on mac? e.g. The following did not work:

file:///Users/me/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd
file:////Users/me/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd
file://Users/me/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd

推薦答案

認(rèn)為我的問題是 webapp 目錄可能無法查看資源文件夾.

Think my issue was that the webapp dir may not have visibility to the resources folder.

我這樣說是因?yàn)榛趯?duì)以下堆棧溢出問題的閱讀,看起來相對(duì)路徑的東西應(yīng)該非常直截了當(dāng):帶有 XML Schema 本地副本的 XML 文件 和 如何在 XML 文檔中使用本地機(jī)器上的 Schema

I say this because based on the reading of the following stack overflow questions, it looks like the relative path stuff should be pretty straigh forward: XML File with local copy of XML Schema and How to use Schema that is on local machine in XML document

然后我嘗試暴力破解引用,以防它與部署目錄或類路徑有關(guān),并且以下所有操作都失敗了:

I then tried to brute force the references, in case it was something with deploy directory or class path, and all of the following failed:

../../../../resources/ehcache-spring-1.2.xsd
../../../resources/ehcache-spring-1.2.xsd
../../resources/ehcache-spring-1.2.xsd
../resources/ehcache-spring-1.2.xsd
./resources/ehcache-spring-1.2.xsd
../ehcache-spring-1.2.xsd
./ehcache-spring-1.2.xsd

解決辦法:

但是,通過將 xsd 文件從 ./src/main/resources/ 移動(dòng)到 ./src/main/webapp/WEB-INF/spring/ 我當(dāng)時(shí)只需 ehcache-spring-1.2.xsd

However by moving the xsd file from ./src/main/resources/ to ./src/main/webapp/WEB-INF/spring/ I was then able to reference it correctly/easily by just ehcache-spring-1.2.xsd

這篇關(guān)于如何通過相對(duì)路徑引用本地 XSD 文件的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環(huán)繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動(dòng)生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數(shù)據(jù)庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對(duì)象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 蜜桃一区| 成人免费淫片aa视频免费 | 天天影视网天天综合色在线播放 | 在线日韩精品视频 | 国产在线对白 | 精品久久久久久久久久久 | 国产在线精品区 | 精品久久一区 | 91在线网站 | 超碰成人免费 | 先锋av资源网 | 91在线电影| 亚洲乱码一区二区三区在线观看 | 日韩精品在线视频免费观看 | 欧美视频一级 | 99热在线观看精品 | 久久精品久久久久久 | 91在线一区二区三区 | 国产福利资源在线 | 欧美日韩精品综合 | 精品国产91乱码一区二区三区 | 欧美一级二级在线观看 | 欧美v免费 | 免费视频一区二区 | 欧美日韩国产三级 | 日韩精品一区二区三区四区视频 | 麻豆精品国产91久久久久久 | 国产美女在线观看 | 69电影网 | 欧美 日韩 中文 | 免费观看一级特黄欧美大片 | 欧美一区二区久久 | 国产高清久久 | 欧美男人亚洲天堂 | www.9191.com| 韩日在线观看视频 | 韩国理论电影在线 | 欧美一级在线免费 | 成人精品一区 | 玖草资源 | 国产不卡一 |