【发布时间】:2016-08-10 06:20:27
【问题描述】:
我正在尝试使用 xsd.exe 从 xsd 文件创建类,但得到这个:
警告:无法生成类,因为没有找到具有复杂类型的顶级元素。
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2008 sp1 (http://www.altova.com) by (EMBRACE) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://comp.com/service/model/extension" targetNamespace="http://comp.com/service/model/extension">
<xs:complexType name="attachment">
<xs:sequence>
<xs:element name="fileIdentifier" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="metadataSystem">
<xs:sequence>
<xs:element name="activityId" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="from" type="xs:long" minOccurs="0"></xs:element>
<xs:element name="href" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="performers" type="xs:long" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
我在哪里有这个顶级元素? 如果我添加:
<xs:element name="attachment" type="attachment" />
我明白了:
缺少类型“附件”
This question不要帮忙,添加元素标签会抛出新错误。
【问题讨论】:
-
我看过这个问题,但是添加元素标签对我没有帮助。
-
我认为这不是完全重复,至少与另一个问题不同,因为顶级元素声明也存在问题。