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
验证XML架构(xsd)错误_Xml_Netbeans_Schema_Xsd - Fatal编程技术网

验证XML架构(xsd)错误

验证XML架构(xsd)错误,xml,netbeans,schema,xsd,Xml,Netbeans,Schema,Xsd,我一直遇到这个错误,我无法找出代码中的错误(我使用的是NetBeans IDE 6.7.1: cvc-complex-type.2.4.a: Invalid content was found starting with element 'manufacturer'. One of '{manufacturer}' is expected. [14] cvc-complex-type.2.4.a: Invalid content was found starting with element

我一直遇到这个错误,我无法找出代码中的错误(我使用的是NetBeans IDE 6.7.1:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'manufacturer'.  One of '{manufacturer}' is expected. [14] 
cvc-complex-type.2.4.a: Invalid content was found starting with element 'manufacturer'. One of '{manufacturer}' is expected. [23] 
cvc-complex-type.2.4.a: Invalid content was found starting with element 'manufacturer'. One of '{manufacturer}' is expected. [32] 
XML validation finished.
以下是我的XML代码:

<?xml version="1.0" encoding="UTF-8"?>
<jobList xmlns="http://www.w3schools.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com jobList.xsd">

<job status="unallocated">
    <resource employeeId="AD145267" type="Laptop">
        <manufacturer>Dell</manufacturer>
        <model>Vostro 1540</model>
        <serialNumber>764839211-19-H</serialNumber>
    </resource>
    <problem reported="2012-01-22T15:23:00">Fails to boot</problem>
</job>

<job status="unallocated">
    <resource employeeId="TE135218" type="Wireless printer">
        <manufacturer>Epson</manufacturer>
        <model>Stylus SX435W</model>
        <serialNumber>E4356-982312</serialNumber>
    </resource>
    <problem reported="2012-01-23T10:07:00">No wireless access</problem>
</job>

<job status="allocated">
    <resource type="Network drive">
        <manufacturer>G-Tech</manufacturer>
        <model>G-RAID Hard drive array</model>
        <serialNumber>783451287G</serialNumber>
    </resource>
    <problem reported="2012-01-24T11:02:00">Read errors reported during rebuild</problem>

    <work jobId="564">
        <technician allocated="2012-01-24T15:05:00">T541</technician>
        <note>Spoke to Eric about what happened.</note>
        <note>Ran phase 1 diagnostics - no errors reported</note>
    </work>
</job>

</jobList>

戴尔
沃斯特罗1540
764839211-19-H
无法启动
爱普生
触针SX435W
E4356-982312
没有无线接入
G-Tech
G-RAID硬盘驱动器阵列
783451287G
重建期间报告的读取错误
T541
跟Eric谈了发生的事。
运行阶段1诊断-未报告任何错误
这是模式代码

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3schools.com"   targetNamespace="http://www.w3schools.com">

<xs:element name="jobList">
<xs:complexType>
  <xs:sequence minOccurs="0" maxOccurs="unbounded">
    <xs:element ref="job"/>
  </xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="job">
<xs:complexType>
  <xs:sequence>
    <xs:element ref="resource"/>
    <xs:element ref="problem"/>
    <xs:sequence minOccurs="0">
      <xs:element ref="work"/>
    </xs:sequence>
  </xs:sequence>
  <xs:attribute name="status" use="required">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="unallocated"/>
        <xs:enumeration value="allocated"/>
        <xs:enumeration value="completed"/>
        <xs:enumeration value="confirmed"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
</xs:complexType>
</xs:element>

<xs:element name="resource">
<xs:complexType>
  <xs:sequence>
    <xs:element name="manufacturer" type="xs:string"/>
    <xs:element name="model" type="xs:string"/>
    <xs:element name="serialNumber" type="xs:string"/>
  </xs:sequence>
  <xs:attribute name="employeeId" type="xs:string"/>
  <xs:attribute name="type" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>

<xs:element name="problem">
<xs:complexType>
  <xs:simpleContent>
    <xs:extension base="xs:string">
      <xs:attribute name="reported" type="xs:dateTime" use="required"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>
</xs:element>

<xs:element name="work">
<xs:complexType>
  <xs:sequence>
    <xs:element ref="technician"/>
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="note"/>
    </xs:sequence>
  </xs:sequence>
  <xs:attribute name="jobId" type="xs:positiveInteger" use="required"/>
</xs:complexType>
</xs:element>

<xs:element name="technician">
<xs:complexType>
  <xs:simpleContent>
    <xs:extension base="xs:string">
      <xs:attribute name="allocated" type="xs:dateTime" use="required"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="note" type="xs:string"/>
</xs:schema>

它查看了制造商,我正在努力找出问题所在。我还将链接相关的DTD代码,以防额外的信息有用

<!ELEMENT resource (manufacturer, model, serialNumber)>
<!ELEMENT manufacturer (#PCDATA)>
<!ELEMENT model (#PCDATA)>
<!ELEME.....


您的架构希望找到一个没有命名空间的
。例如:

<manufacturer xmlns="">...</manufacturer>

这就解决了这个问题!我是一个使用XML/Schema等的新手。你介意告诉我是否还有其他方法可以使用Schema文件声明XML吗?如果我使用NoNamespaceSchemaCalation,我可以省略部分声明/引用吗?请不要问这样的补充问题。对于新问题,开始一个新线程。
<xs:schema ... elementFormDefault="qualified"> ... </xs:schema>