xsd 验证失败 - 引用本地 xsd 文件

xsd validation failed - Reference local xsd file

我有一个 xml 文件,其中包含我以前从未见过的 dt:dt:

<?xml version='1.0' encoding='UTF-8'?>
<enfinity xsi:schemaLocation="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt dt.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt" major="6" minor="1" family="enfinity" branch="enterprise" build="build">
  <offer sku="423182110">
    <custom-attributes>
      <custom-attribute name="sizeEU" dt:dt="string">42</custom-attribute>
    </custom-attributes>
  </offer>
</enfinity> 

当我用VS根据上面的xml创建一个xsd时,它创建了2个文件:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:attribute name="dt" type="xs:string" />
</xs:schema>

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xs:import namespace="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt" />
    <xs:element name="enfinity">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" name="offer">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="short-description">
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute ref="xml:lang" use="required" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                            <xs:element minOccurs="0" name="variations">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="mastered-products">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element maxOccurs="unbounded" name="mastered-product">
                                                        <xs:complexType>
                                                            <xs:attribute name="sku" type="xs:unsignedInt" use="required" />
                                                            <xs:attribute name="domain" type="xs:string" use="required" />
                                                            <xs:attribute name="default" type="xs:unsignedByte" use="required" />
                                                            <xs:attribute name="productvariationposition" type="xs:unsignedShort" use="required" />
                                                        </xs:complexType>
                                                    </xs:element>
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="variation-attributes">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element maxOccurs="unbounded" name="variation-attribute">
                                                        <xs:complexType>
                                                            <xs:sequence>
                                                                <xs:element name="presentation-option" type="xs:string" />
                                                                <xs:element minOccurs="0" name="presentation-product-attribute-name" type="xs:string" />
                                                                <xs:element name="custom-attributes">
                                                                    <xs:complexType>
                                                                        <xs:sequence>
                                                                            <xs:element name="custom-attribute">
                                                                                <xs:complexType>
                                                                                    <xs:simpleContent>
                                                                                        <xs:extension base="xs:string">
                                                                                            <xs:attribute name="name" type="xs:string" use="required" />
                                                                                            <xs:attribute ref="dt:dt" use="required" />
                                                                                            <xs:attribute ref="xml:lang" use="required" />
                                                                                        </xs:extension>
                                                                                    </xs:simpleContent>
                                                                                </xs:complexType>
                                                                            </xs:element>
                                                                        </xs:sequence>
                                                                    </xs:complexType>
                                                                </xs:element>
                                                            </xs:sequence>
                                                            <xs:attribute name="name" type="xs:string" use="required" />
                                                        </xs:complexType>
                                                    </xs:element>
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="custom-attributes">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element maxOccurs="unbounded" name="custom-attribute">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                        <xs:attribute ref="dt:dt" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                        <xs:attribute name="sku" type="xs:unsignedInt" use="required" />
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attribute name="major" type="xs:unsignedByte" use="required" />
            <xs:attribute name="minor" type="xs:unsignedByte" use="required" />
            <xs:attribute name="family" type="xs:string" use="required" />
            <xs:attribute name="branch" type="xs:string" use="required" />
            <xs:attribute name="build" type="xs:string" use="required" />
        </xs:complexType>
    </xs:element>
</xs:schema>

我认为我需要编辑较大的 xsd 以便它知道另一个 xsd 模式在哪里,但我该怎么做?目前,当我在 VS 中打开较大的 xsd 时,它只有 this error

我试过改变

<xs:import namespace="intershop.com/xml/ns/enfinity/6.5/core/impex-dt" />

<xs:import namespace="intershop.com/xml/ns/enfinity/6.5/core/impex-dt" dt:schemaLocation="C:\Users\TommyTam\Downloads\Upload To Exponea\Mulesoft\Item Variant Flow Poll\Item Variant Flow Poll_XML (ADDITIONAL).xsd dt.xsd"/>

但还是不正确。

xs:import 元素作为 schemaLocation 属性 (https://www.w3.org/TR/xmlschema-0/#schemaLocation) 相对或绝对 URL 包含该命名空间架构的文件,例如<xs:import namespace="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt" schemaLocation="dt.xsd"/> 将是指向名为 dt.xsd 的本地文件的一种方法,该文件与包含 xs:import 声明的文件位于同一目录中。