wsdl2py
これはJAXBではなくの欠点ですが、XSLTまたはXQueryを使用して修正するのはとても簡単です。XSLTでこれを修正する簡単な試み:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsl:template match="xsd:complexType[xsd:complexContent/xsd:extension]">
<xsd:complexType>
<xsl:apply-templates select="@*" />
<xsl:apply-templates select="xsd:annotation" />
<xsd:sequence>
<xsl:variable name="typeQName" select="string(xsd:complexContent/xsd:extension/@base)" />
<xsl:variable name="typeName"><xsl:choose>
<xsl:when test="contains($typeQName, ':')">
<xsl:value-of select="substring-after($typeQName, ':')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$typeQName" />
</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:comment>Included from <xsl:value-of select="$typeQName" />):
</xsl:comment>
<xsl:apply-templates select="//xsd:complexType[@name=$typeName]/*" />
<xsl:comment>Original extension:</xsl:comment>
<xsl:apply-templates select="xsd:complexContent/xsd:extension/*" />
</xsd:sequence>
<xsl:apply-templates
select="xsd:attribute | xsd:attributeGroup | xsd:attributeGroup" />
</xsd:complexType>
</xsl:template>
<!-- General copy rule -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
注意事項:これは拡張機能でのみ機能し、制限では機能せず、wsdl2py
サポートされているかどうかに関係なくネストされたシーケンスを使用します(簡単に修正できるはずです)。現在、コンテンツモデルのみをサポートしていますが、属性と属性グループをコピーするように簡単に拡張できます。
また、スタイルシートは、拡張要素がベースと同じスキーマファイルに存在する場合にのみ機能します。
幸運を!