XML 架构错误:缺少必需的空格
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11691962/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
XML Schema Error: Required white space was missing
提问by Josh McKearin
I have been searching on this for hours and can not figure out the issue. Could someone please help me with this? I am getting the above error when Executing a SQLXMLBULKLOAD in VB.NET 2010. I have attempted changing my xml declaration, my schema attributes, on and on and can not get past this error. It seems to be trivial but I can not figure it out. Please help
我已经搜索了几个小时,但无法弄清楚问题所在。有人可以帮我解决这个问题吗?在 VB.NET 2010 中执行 SQLXMLBULKLOAD 时出现上述错误。我尝试不断更改我的 xml 声明、架构属性,但无法克服此错误。这似乎微不足道,但我无法弄清楚。请帮忙
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="Employees" sql:is-constant="1">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="Employee" sql:relation="the_Employees">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<!--<xsd:element name="id" type="xsd:integer" />-->
<xsd:element name="EmployeeID"sql:field="EmpNo">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="FirstName"sql:field="FirstName">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
回答by Mikael Eriksson
You need a space between attributes.
属性之间需要一个空格。
Like this one in line 10.
就像第 10 行中的这个。
<xsd:element name="EmployeeID"sql:field="EmpNo">
should be
应该
<xsd:element name="EmployeeID" sql:field="EmpNo">
回答by zanegray
And on this one in line 16 you need a space. otherwise, you are good to go:
在第 16 行的这一行中,您需要一个空格。否则,你很高兴:
<xsd:element name="FirstName"sql:field="FirstName">
<xsd:element name="FirstName"sql:field="FirstName">
change to:
改成:
<xsd:element name="FirstName" sql:field="FirstName">
<xsd:element name="FirstName" sql:field="FirstName">

