【问题标题】:Jaxb2 catalog file with relative paths具有相对路径的 Jaxb2 目录文件
【发布时间】:2014-03-04 10:43:42
【问题描述】:

我正在尝试从很多 XSD 生成一些 Java 代码。它们中的大多数都工作得很好,但是我在使用一个特定的 XSD 时遇到了麻烦,它导入了另一个具有相对路径的 XSD。一个例子:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:xmpl="http://example.com/this/is/namespace" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.com/this/is/namespace">
    <include schemaLocation="../../0301/required.xsd" />
    <some> ... xml ... </some>
</schema>

当然,由于客户端,这是一个匿名的 XSD。但是,我已经构建了它在另一个模块中引用的另一个 XSD。顺便说一句,这很好用。所以现在我想解决包含问题,但我目前不成功。我尝试了不同的多个目录,如下所示:

<!DOCTYPE catalog
    PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" 
    "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">

    <public publicId="required.xsd" uri="maven:com.geodan.imgeo:stuf!stuf0301!stuf/stuf0301.xsd" />

    <public publicId="../../0301/required.xsd" uri="maven:com.project.example!module!folder/required.xsd" />

    <public publicId="http://example.com/this/is/namespace/required.xsd" uri="maven:com.project.example!module!folder/required.xsd" />

    <public publicId="http://example.com/this/is/namespace/../../required.xsd" uri="maven:com.project.example!module!folder/required.xsd" />

    <public publicId="http://example.com/stuf0301.xsd" uri="maven:com.project.example!module!folder/required.xsd" />

</catalog>

--
  Standard Catalog test file for Imgeo
--

PUBLIC "http://example.com/this/is/namespace/required.xsd" "module/src/main/resources/folder/required.xsd"

PUBLIC "../../0301/required.xsd" "module/src/main/resources/folder/required.xsd"

PUBLIC "0301/required.xsd" "module/src/main/resources/folder/required.xsd" 

但它只是行不通。有人有什么想法吗?

【问题讨论】:

    标签: java jaxb xsd jaxb2 catalog


    【解决方案1】:

    不幸的是,maven-jaxb2-plugin 项目在这个主题上有一个未解决的问题: Allow rewriting system ids for local files #19

    【讨论】:

      猜你喜欢
      • 2023-01-12
      • 2012-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-03
      • 1970-01-01
      • 1970-01-01
      • 2013-04-10
      相关资源
      最近更新 更多