Cannot find the declaration of element

来源:2-7 自由编程

秒杀1

2018-12-14 21:31:05

<?xml version="1.0" encoding="UTF-8"?>

<!-- <!DOCTYPE teaching-plan SYSTEM "xml1.10.dtd"> -->

<teaching-plan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

xsi:noNamespaceSchemaLocation="xml1.10.xsd">

  <course no="1">

    <course-name>大学英语</course-name>

    <class-hour>76</class-hour>

    <exam-form>考试</exam-form>

  </course>

  <course no="2">

    <course-name>高等数学</course-name>

    <class-hour>70</class-hour>

    <exam-form>考试</exam-form>

  </course>

  <course no="3">

    <course-name>计算机网络</course-name>

    <class-hour>80</class-hour>

    <exam-form>上机考试</exam-form>

  </course>

</teaching-plan>

=================================================

<?xml version="1.0" encoding="UTF-8"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/xml1.10" xmlns:tns="http://www.example.org/xml1.10" elementFormDefault="qualified">

    <element name="teaching-plan">

       <complexType>

          <sequence>

              <element name="course" minOccurs="1" maxOccurs="100">

                 <complexType>

                    <sequence>

                       <element name="course-name" type="string"></element>

                       <element name="class-hour">

                          <simpleType>

                              <restriction base="integer">

                                 <minInclusive value="20"></minInclusive>

                                 <maxInclusive value="110"></maxInclusive>

                              </restriction>

                          </simpleType>

                       </element>

                       <element name="exam-form" type="string"></element>

                    </sequence>

                     <attribute name="no" type="integer" use="required"></attribute>

                 </complexType>

              </element>

          </sequence>

       </complexType>

    </element>

</schema>


写回答

1回答

好帮手慕阿莹

2018-12-16

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/xml1.10" xmlns:tns="http://www.example.org/xml1.10" elementFormDefault="qualified">  

改为:

<schema xmlns="http://www.w3.org/2001/XMLSchema" >

把后边的那些去掉就可以了。

因为咱们的xml中引用时用的不带名称空间的。

http://img.mukewang.com/climg/5c15d3330001877f05410062.jpg

同学把xsd中<schema xmlns="http://www.w3.org/2001/XMLSchema" >后边其他的去掉就可以了。

如果我的回答解决了你的问题,请采纳,祝学习愉快.

1

0 学习 · 10204 问题

查看课程