Tag: xsi

如何通过相对路径引用本地XSD文件

这是关于如何配置Eclipse以使用`ehcache`的后续内容,并且在如何正确引用本地XML架构文件中有一个绝对路径示例? 由于不再托管xsd文件,我从存档中下载了它的副本。 我把文件放在我的资源目录中,并希望从我项目的相对路径中的xsi:schemaLocation引用它。 我们有windows和mac开发人员,因此像file:///c:/project/foo这样的绝对路径约定将不起作用。 相对路径的另一种替代方法是,如果有一种方法可以引用windows和mac的系统属性,那么我可以执行2个条目,如file:///$HOME/workspace/foo 。 我的mac上的项目存在于~/workspace/foo ,$ HOME的echo给出了我的主路径。 我的spring-cache.xml存在于./src/main/webapp/WEB-INF/spring/ 我的ehcache-spring-1.2.xsd存在于./src/main/resources/ 以下是我尝试过的一些没有成功: 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 我似乎也有问题让它从绝对路径引用文件,所以也许有一种不同的方式来引用mac上的文件? 例如以下不起作用: 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