我正在尝试为类别制作 XSD,但它总是给我这个警告错误警告:在此架构中无法引用命名空间“”错误:未报告“类别”我试图制作未指定层次结构级别的递归类别
这是我的 XSD 结构
<xs:schema xmlns:tns="http://www.tempuri.org" targetNamespace="http://www.tempuri.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Categories">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Category" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Category">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="code" type="xs:string" />
<xs:element name="parent" nillable="true" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="unbounded" ref="Category" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
所需的xml就像
<?xml version="1.0" encoding="utf-8"?>
<Categorıes>
<Category>
<Code>1</Code>
<Name>Kategori1</Name>
<Parent>0</Parent>
<Category>
<Code>11</Code>
<Name>Kategori11</Name>
<Parent>1</Parent>
<Category>
<Code>111</Code>
<Name>Kategori111</Name>
<Parent>11</Parent>
</Category>
</Category>
</Category>
<Category>
<Code>2</Code>
<Name>Kategori2</Name>
<Parent>0</Parent>
<Category>
<Code>21</Code>
<Name>Kategori21</Name>
<Parent>2</Parent>
<Category>
<Code>211</Code>
<Name>Kategori211</Name>
<Parent>21</Parent>
</Category>
<Category>
<Code>212</Code>
<Name>Kategori212</Name>
<Parent>21</Parent>
</Category>
</Category>
</Category>
</Categorıes>
请帮我