让我们先看看我是否可以根据我的理解来说明您的问题。
假设您有架构 A.xsd:
<?xml version="1.0" encoding="utf-8" ?>
<!-- XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com) -->
<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="Base">
<xsd:sequence>
<xsd:element name="First"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
还有一个重新定义(B重新定义A):
<?xml version="1.0" encoding="utf-8"?>
<!--XML Schema generated by QTAssistant/XSR Module (http://www.paschidev.com)-->
<xsd:schema xmlns="[{no target namespace}]" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="[{no target namespace}]" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:redefine schemaLocation="A.xsd">
<xsd:complexType name="Base">
<xsd:complexContent>
<xsd:extension base="Base">
<xsd:sequence>
<xsd:element name="Second" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:redefine>
</xsd:schema>
我对您的说法的理解a String, where the redefine is already handled (The string should represent the merged 2 XSD files)
如下:
<?xml version="1.0" encoding="utf-8"?>
<!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xmlns="">Generated from "Set1" under "Release1"</xsd:documentation>
</xsd:annotation>
<xsd:complexType name="Base">
<xsd:sequence>
<xsd:element name="First" type="xsd:anyType"/>
<xsd:element minOccurs="0" name="Second" type="xsd:anyType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
如果这就是您要问的,那么我不知道有任何 Java 解决方案会自动执行请求的重构。有可能做到;据我所知,您必须自己编写代码。
我知道的唯一工具,专门设计用于涵盖您的场景,是我与之关联的工具,但它仅在 .NET 上运行(最近它需要 .NET 4.0,这使得 Mono 平台遥不可及)。