为什么会报错Element teaching-plan must be declared
<?xml version="1.0" encoding="UTF-8"?>
<!--<!DOCTYPE teaching-plan SYSTEM "Plan.dtd">-->
<teaching-plan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="plan.xsd"/>
<teaching-plan>
<course id="o1">
<course-name>大学英语</course-name>
<class-hour>36</class-hour>
<exam-form>考试</exam-form>
</course>
<course id="o2">
<course-name>高等数学</course-name>
<class-hour>70</class-hour>
<exam-form>考试</exam-form>
</course>
<course id="o3">
<course-name>计算机应用基础</course-name>
<class-hour>108</class-hour>
<exam-form>上机考试</exam-form>
</course>
</teaching-plan>
//XSD语言
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<element name="teacher-plan" >
<complexType>
<sequence>
<element name="course" minOccurs="0" maxOccurs="100">
<complexType>
<sequence>
<element name="course-name" type="string"/>
<element name="class-hour">
<simpleType>
<restriction base="integer">
<minInclusive value="20"/>
<maxInclusive value="110"/>
</restriction>
</simpleType>
</element>
<element name="exam-form" type="string"/>
</sequence>
<attribute name="id" type="string" use="required"/>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>
正在回答
你好同学,如下图所示标记的单词应改为teaching-plan,祝学习愉快~
你好同学,teaching-plan标签重复了,并且下图标记的/代表当前的标签是结束的,
修订之后的xml代码如下:
<?xml version="1.0" encoding="UTF-8"?> <!--<!DOCTYPE teaching-plan SYSTEM "Plan.dtd"> --> <teaching-plan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="plan.xsd"> <course id="o1"> <course-name>大学英语</course-name> <class-hour>36</class-hour> <exam-form>考试</exam-form> </course> <course id="o2"> <course-name>高等数学</course-name> <class-hour>70</class-hour> <exam-form>考试</exam-form> </course> <course id="o3"> <course-name>计算机应用基础</course-name> <class-hour>108</class-hour> <exam-form>上机考试</exam-form> </course> </teaching-plan>
修订之后的xsd代码如下,祝学习愉快~
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema"> <element name="teaching-plan" > <complexType> <sequence> <element name="course" minOccurs="0" maxOccurs="100"> <complexType> <sequence> <element name="course-name" type="string"/> <element name="class-hour"> <simpleType> <restriction base="integer"> <minInclusive value="20"/> <maxInclusive value="110"/> </restriction> </simpleType> </element> <element name="exam-form" type="string"/> </sequence> <attribute name="id" type="string" use="required"/> </complexType> </element> </sequence> </complexType> </element> </schema>
- 参与学习 人
- 提交作业 1088 份
- 解答问题 10205 个
如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星