Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
简单xmlschema-XSD_Xml_Xsd - Fatal编程技术网

简单xmlschema-XSD

简单xmlschema-XSD,xml,xsd,Xml,Xsd,我有以下xsd文件,它抛出了“无效模式”错误。我以前做过很多复杂的模式,但似乎无法找出这个模式的错误,这应该是非常直接的。我知道我以后需要一些东西 <xsd:element name="ebay"> 但是什么呢 XML: <ebay><userID></userID></ebay> Schema: <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://

我有以下xsd文件,它抛出了“无效模式”错误。我以前做过很多复杂的模式,但似乎无法找出这个模式的错误,这应该是非常直接的。我知道我以后需要一些东西

<xsd:element name="ebay">

但是什么呢

XML:
<ebay><userID></userID></ebay>


Schema:
    <?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="ebay">

<xsd:element name="userID">
   <xsd:simpleType>
     <xsd:restriction base="xsd:string">
       <xsd:minLength value="1"/>
       <xsd:maxLength value="255"/>
       <xsd:whiteSpace value="collapse"/> 
     </xsd:restriction>
   </xsd:simpleType>
 </xsd:element>

</xsd:element>
</xsd:schema>
XML:
模式:

您需要定义名称空间xs:to“http://www.w3.org/2001/XMLSchema,您使用了两个名称空间,但只定义了xsd。你真的应该只使用其中一个。此外,我不认为可以在字符串上使用minInclusive value或maxInclusiveValue。

尝试以下模式:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="ebay">
    <xs:complexType>
      <xs:sequence>
        <xsd:element name="userID">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:minLength value="1"/>
              <xsd:maxLength value="255"/>
              <xsd:whiteSpace value="collapse"/> 
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xs:sequence>
    </xs:complexType>
  </xsd:element>
</xsd:schema>


oops,这是通过复制和粘贴实现的!我已经编辑了上面的内容,但仍然得到了错误。你删除了不能在字符串上使用的最小/最大包含值了吗?是的,我以前使用过,它不会抛出错误。我已经改变了它,但我仍然得到了错误。是的,我需要这个和之前的。谢谢