gpt4 book ai didi

xml - 如何在 jar 文件中引用 xsd 架构定位?

转载 作者:数据小太阳 更新时间:2023-10-29 02:51:32 24 4
gpt4 key购买 nike

我有一个 xml 模式 (xsd) 文件,它位于一个 jar 文件中,该文件将包含在运行时类路径中。在我的 Wsdl 中,我需要通过在 jar 文件中提供位置来导入模式。

我尝试使用 XML 目录,但我使用的服务器 (websphere) 不解析 xml 目录引用。

最佳答案

我们遇到了类似的问题,其中包含 XSD 的 JAR 被添加到类路径中,我们不得不使用 schemaLocation 从 WSDL 引用它。我们的项目是基于 maven 的,所以我们使用 maven-dependency-plugin 的 unpack 目标在编译之前将文件下载到 resources 文件夹。

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>${version}</version>
<outputDirectory>${basedir}/src/main/resources/xsd</outputDirectory>
<includes>ToDownload.xsd</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>

这导致 xsd 下载到名为 xsd 的文件夹中的资源目录。
在 WSDL schemaLocation="xsd/ToDownload.xsd". 中这确保在编译期间 WSDL 将引用已下载并在本地可用的 XSD。

关于xml - 如何在 jar 文件中引用 xsd 架构定位?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17691746/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com