1

同じ名前の複数のレベルを持つ大きなスキーマがあります。(書いてない!)

ここにあります:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.CIP4.org/JDFSchema_1_1" xmlns:efi="http://www.efi.com/efijdf"
    xmlns:ssi="http://www.creo.com/SSI/JDFExtensions.xsd" xmlns:jdf="http://www.CIP4.org/JDFSchema_1_1">

    <xs:import namespace="http://www.efi.com/efijdf" schemaLocation="EFI-JDF.xsd" />
    <xs:import namespace="http://www.creo.com/SSI/JDFExtensions.xsd" schemaLocation="SSiJDFExtensions.xsd" />

    <xs:element name="JDF">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Comment">
                    <xs:complexType>
                        <xs:simpleContent>
                            <xs:extension base="xs:string">
                                <xs:attribute type="xs:string" name="AgentName" />
                                <xs:attribute type="xs:string" name="AgentVersion" />
                                <xs:attribute type="xs:dateTime" name="TimeStamp" />
                            </xs:extension>
                        </xs:simpleContent>
                    </xs:complexType>
                </xs:element>
                <xs:element name="AuditPool">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="Created">
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute type="xs:string" name="AgentName" />
                                            <xs:attribute type="xs:string" name="AgentVersion" />
                                            <xs:attribute type="xs:string" name="ID" />
                                            <xs:attribute type="xs:dateTime" name="TimeStamp" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="ResourcePool">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="Layout">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="Layout" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="Layout">
                                                        <xs:complexType>
                                                            <xs:sequence>
                                                                <xs:element name="Media" type="jdf:MediaType" />
                                                                <xs:element name="TransferCurvePool">
                                                                    <xs:complexType>
                                                                        <xs:sequence>
                                                                            <xs:element name="TransferCurveSet">
                                                                                <xs:complexType>
                                                                                    <xs:simpleContent>
                                                                                        <xs:extension base="xs:string">
                                                                                            <xs:attribute type="xs:string" name="CTM" use="optional" />
                                                                                            <xs:attribute type="xs:string" name="Name" use="optional" />
                                                                                        </xs:extension>
                                                                                    </xs:simpleContent>
                                                                                </xs:complexType>
                                                                            </xs:element>
                                                                        </xs:sequence>
                                                                        <xs:attribute type="xs:string" name="Class" use="optional" />
                                                                    </xs:complexType>
                                                                </xs:element>
                                                                <xs:element name="MediaRef">
                                                                    <xs:complexType>
                                                                        <xs:simpleContent>
                                                                            <xs:extension base="xs:string">
                                                                                <xs:attribute type="xs:string" name="rRef" use="optional" />
                                                                            </xs:extension>
                                                                        </xs:simpleContent>
                                                                    </xs:complexType>
                                                                </xs:element>
                                                                <xs:element name="Layout4" maxOccurs="unbounded" minOccurs="0">
                                                                    <xs:complexType>
                                                                        <xs:choice maxOccurs="unbounded" minOccurs="0">
                                                                            <xs:element name="MarkObject">
                                                                                <xs:complexType>
                                                                                    <xs:simpleContent>
                                                                                        <xs:extension base="xs:string">
                                                                                            <xs:attribute type="xs:string" name="CTM" use="optional" />
                                                                                            <xs:attribute type="xs:string" name="ClipBox" use="optional" />
                                                                                            <xs:attribute type="xs:byte" name="Ord" use="optional" />
                                                                                        </xs:extension>
                                                                                    </xs:simpleContent>
                                                                                </xs:complexType>
                                                                            </xs:element>
                                                                            <xs:element name="ContentObject">
                                                                                <xs:complexType>
                                                                                    <xs:simpleContent>
                                                                                        <xs:extension base="xs:string">
                                                                                            <xs:attribute type="xs:string" name="CTM" use="optional" />
                                                                                            <xs:attribute type="xs:string" name="ClipBox" use="optional" />
                                                                                            <xs:attribute type="xs:byte" name="Ord" use="optional" />
                                                                                            <xs:attribute ref="ssi:Comp" />
                                                                                            <xs:attribute ref="ssi:TrimBox1" />
                                                                                            <xs:attribute type="xs:string" name="TrimCTM" use="optional" />
                                                                                            <xs:attribute type="xs:string" name="TrimSize" use="optional" />
                                                                                        </xs:extension>
                                                                                    </xs:simpleContent>
                                                                                </xs:complexType>
                                                                            </xs:element>
                                                                        </xs:choice>
                                                                        <xs:attribute ref="ssi:Dimension" />
                                                                        <xs:attribute ref="ssi:MediaOrigin" />
                                                                        <xs:attribute type="xs:string" name="Side" use="optional" />
                                                                        <xs:attribute type="xs:string" name="Status" use="optional" />
                                                                        <xs:attribute type="xs:string" name="SurfaceContentsBox" use="optional" />
                                                                    </xs:complexType>
                                                                </xs:element>
                                                            </xs:sequence>
                                                            <xs:attribute ref="ssi:WorkStyle" />
                                                            <xs:attribute type="xs:string" name="SheetName" use="optional" />
                                                            <xs:attribute type="xs:string" name="SurfaceContentsBox" use="optional" />
                                                            <xs:attribute type="xs:string" name="WorkStyle" use="optional" />
                                                        </xs:complexType>
                                                    </xs:element>
                                                </xs:sequence>
                                                <xs:attribute type="xs:string" name="SignatureName" use="optional" />
                                                <xs:attribute type="xs:string" name="Status" use="optional" />
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                    <xs:attribute type="xs:string" name="Class" />
                                    <xs:attribute type="xs:string" name="DescriptiveName" />
                                    <xs:attribute type="xs:string" name="ID" />
                                    <xs:attribute type="xs:string" name="PartIDKeys" />
                                    <xs:attribute type="xs:string" name="Status" />
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="Media" type="jdf:MediaType" />
                            <xs:element name="RunList" maxOccurs="unbounded" minOccurs="0">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="RunList2" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="LayoutElement" type="jdf:LayoutElementType" />
                                                </xs:sequence>
                                                <xs:attribute type="xs:byte" name="NPage" use="optional" />
                                                <xs:attribute type="xs:string" name="Pages" use="optional" />
                                                <xs:attribute type="xs:byte" name="Run" use="optional" />
                                                <xs:attribute type="xs:string" name="Status" use="optional" />
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="PageList" minOccurs="0">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="PageData" maxOccurs="unbounded" minOccurs="0">
                                                        <xs:complexType>
                                                            <xs:simpleContent>
                                                                <xs:extension base="xs:string">
                                                                    <xs:attribute type="xs:string" name="DescriptiveName" use="optional" />
                                                                    <xs:attribute type="xs:string" name="PageIndex" use="optional" />
                                                                </xs:extension>
                                                            </xs:simpleContent>
                                                        </xs:complexType>
                                                    </xs:element>
                                                </xs:sequence>
                                                <xs:attribute type="xs:string" name="Class" />
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="LayoutElement" type="jdf:LayoutElementType" />
                                    </xs:sequence>
                                    <xs:attribute type="xs:string" name="Class" use="optional" />
                                    <xs:attribute type="xs:string" name="ID" use="optional" />
                                    <xs:attribute type="xs:byte" name="NPage" use="optional" />
                                    <xs:attribute type="xs:string" name="PartIDKeys" use="optional" />
                                    <xs:attribute type="xs:string" name="Status" use="optional" />
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="ResourceLinkPool">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="LayoutLink">
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute type="xs:string" name="Usage" />
                                            <xs:attribute type="xs:string" name="rRef" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="RunListLink" maxOccurs="unbounded" minOccurs="0">
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute type="xs:string" name="ProcessUsage" use="optional" />
                                            <xs:attribute type="xs:string" name="Usage" use="optional" />
                                            <xs:attribute type="xs:string" name="rRef" use="optional" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="MediaLink">
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute type="xs:string" name="Usage" />
                                            <xs:attribute type="xs:string" name="rRef" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attribute type="xs:string" name="Activation" />
            <xs:attribute type="xs:string" name="CommentURL" />
            <xs:attribute type="xs:string" name="DescriptiveName" />
            <xs:attribute type="xs:string" name="ICSVersions" />
            <xs:attribute type="xs:string" name="ID" />
            <xs:attribute type="xs:string" name="JobID" />
            <xs:attribute type="xs:string" name="JobPartID" />
            <xs:attribute type="xs:float" name="MaxVersion" />
            <xs:attribute type="xs:string" name="Status" />
            <xs:attribute type="xs:string" name="Type" />
            <xs:attribute type="xs:float" name="Version" />
        </xs:complexType>
    </xs:element>

    <xs:complexType name="FileSpecType">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute ref="efi:validatecontent" use="optional" />
                <xs:attribute type="xs:string" name="MimeType" use="optional" />
                <xs:attribute type="xs:string" name="URL" use="optional" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="MediaType">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute type="xs:string" name="Brand" use="optional" />
                <xs:attribute type="xs:string" name="Class" use="optional" />
                <xs:attribute type="xs:string" name="DescriptiveName" use="optional" />
                <xs:attribute type="xs:string" name="Dimension" use="optional" />
                <xs:attribute type="xs:byte" name="Grade" use="optional" />
                <xs:attribute type="xs:string" name="GrainDirection" use="optional" />
                <xs:attribute type="xs:string" name="Manufacturer" use="optional" />
                <xs:attribute type="xs:string" name="MediaType" use="optional" />
                <xs:attribute type="xs:string" name="MediaUnit" use="optional" />
                <xs:attribute type="xs:float" name="Thickness" use="optional" />
                <xs:attribute type="xs:byte" name="Weight" use="optional" />
                <xs:attribute type="xs:string" name="BackCoatings" use="optional" />
                <xs:attribute type="xs:byte" name="Brightness" use="optional" />
                <xs:attribute ref="efi:EFPaperCatalogID" use="optional" />
                <xs:attribute type="xs:string" name="FrontCoatings" use="optional" />
                <xs:attribute type="xs:string" name="HoleType" use="optional" />
                <xs:attribute type="xs:string" name="ID" use="optional" />
                <xs:attribute type="xs:string" name="MediaColorName" use="optional" />
                <xs:attribute type="xs:byte" name="MediaSetCount" use="optional" />
                <xs:attribute type="xs:string" name="MediaTypeDetails" use="optional" />
                <xs:attribute type="xs:string" name="Opacity" use="optional" />
                <xs:attribute type="xs:float" name="OpacityLevel" use="optional" />
                <xs:attribute type="xs:string" name="PrePrinted" use="optional" />
                <xs:attribute type="xs:string" name="ProductID" use="optional" />
                <xs:attribute type="xs:byte" name="RecycledPercentage" use="optional" />
                <xs:attribute type="xs:string" name="StockType" use="optional" />
                <xs:attribute type="xs:string" name="Texture" use="optional" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="LayoutElementType">
        <xs:sequence>
            <xs:element name="FileSpec" type="jdf:FileSpecType" />
        </xs:sequence>
    </xs:complexType>

</xs:schema>

EFI-JDF.xsd

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.efi.com/efijdf">
    <xs:attribute type="xs:string" name="EFPaperCatalogID" />
    <xs:attribute type="xs:string" name="validatecontent" />
</xs:schema>

SSiJDFExtensions.xsd

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.creo.com/SSI/JDFExtensions.xsd">
    <xs:attribute type="xs:string" name="Comp" />
    <xs:attribute type="xs:string" name="TrimBox1" />
    <xs:attribute type="xs:string" name="Dimension" />
    <xs:attribute type="xs:string" name="MediaOrigin" />
    <xs:attribute type="xs:string" name="WorkStyle" />
</xs:schema>

「レイアウト」という名前の 3 つの要素に注意してください。次のように、xjbファイルを使用してそれぞれのクラス名を変更しようとしました:

<bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.1">
    <bindings schemaLocation="MetrixJDF.xsd" version="1.0">
        <globalBindings localScoping="toplevel" />

        <schemaBindings xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
            <package name="com.metrixsoftware.vdp.jdf">
            </package>
        </schemaBindings>

        <bindings node="//xs:element[@name='JDF']">
            <bindings node="//xs:attribute[@ref='ssi:WorkStyle']">
                <property name="ssiWorkStyle" />
            </bindings>
        </bindings>

        <bindings
            node="//xs:element[@name='ResourcePool']/xs:complexType/xs:sequence/xs:element[@name='Layout']/xs:complexType/xs:sequence/xs:element[@name='Layout']/xs:complexType/xs:sequence/xs:element[@name='Layout']">
            <class name="Layout3" />
        </bindings>
        <bindings node="//xs:element[@name='ResourcePool']/xs:complexType/xs:sequence/xs:element[@name='Layout']/xs:complexType/xs:sequence/xs:element[@name='Layout']">
            <class name="Layout2" />
        </bindings>
        <bindings node="//xs:element[@name='ResourcePool']/xs:complexType/xs:sequence/xs:element[@name='Layout']">
            <class name="Layout1" />
        </bindings>
    </bindings>
</bindings>

それはうまくいかないようです。xjb ファイルに関するエラーは発生しませんが、実行すると次のエラーが発生しますxjc

parsing a schema...
compiling a schema...
[ERROR] A class/interface with the same name "com.metrixsoftware.vdp.jdf.Layout" is already in use. Use a class customization to resolve this conflict.
    line 44 of file:/C:/Repo/Metrix/WEB-INF/classes/com/metrixsoftware/vdp/schemas/MetrixJDF.xsd
[ERROR] (Relevant to above error) another "Layout" is generated from here.
    line 47 of file:/C:/Repo/Metrix/WEB-INF/classes/com/metrixsoftware/vdp/schemas/MetrixJDF.xsd
[ERROR] A class/interface with the same name "com.metrixsoftware.vdp.jdf.Layout" is already in use. Use a class customization to resolve this conflict.
    line 44 of file:/C:/Repo/Metrix/WEB-INF/classes/com/metrixsoftware/vdp/schemas/MetrixJDF.xsd
[ERROR] (Relevant to above error) another "Layout" is generated from here.
    line 50 of file:/C:/Repo/Metrix/WEB-INF/classes/com/metrixsoftware/vdp/schemas/MetrixJDF.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
    line 50 of file:/C:/Repo/Metrix/WEB-INF/classes/com/metrixsoftware/vdp/schemas/MetrixJDF.xsd
[ERROR] (Related to above error) This is the other declaration.   
    line 44 of file:/C:/Repo/Metrix/WEB-INF/classes/com/metrixsoftware/vdp/schemas/MetrixJDF.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
    line 44 of file:/C:/Repo/Metrix/WEB-INF/classes/com/metrixsoftware/vdp/schemas/MetrixJDF.xsd
[ERROR] (Related to above error) This is the other declaration.   
    line 47 of file:/C:/Repo/Metrix/WEB-INF/classes/com/metrixsoftware/vdp/schemas/MetrixJDF.xsd

Failed to produce code.

バージョン情報:

$ "C:\Java\jdk1.6.0_45.64\bin\xjc.exe" -version
xjc version "JAXB 2.1.10 in JDK 6"
JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build JAXB 2.1.10 in JDK 6)

お知らせ下さい。

4

1 に答える 1