正在回答
idea中要求比较严格,与eclipse中有些不同。老师对同学的代码做了如下修改:
修改后的代码如下:
plan.xsd
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | < xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema" targetNamespace = "http://www.w3school.com.cn" xmlns = "http://www.w3school.com.cn" elementFormDefault = "qualified" > < xs:element name = "teaching-plan" > < xs:complexType > < xs:sequence > < xs:element name = "course" maxOccurs = "100" minOccurs = "0" > < xs:complexType > < xs:sequence > < xs:element name = "course-name" type = "xs:string" ></ xs:element > < xs:element name = "class-hour" > < xs:simpleType > < xs:restriction base = "xs:integer" > < xs:minInclusive value = "20" ></ xs:minInclusive > < xs:maxInclusive value = "110" ></ xs:maxInclusive > </ xs:restriction > </ xs:simpleType > </ xs:element > < xs:element name = "exam-form" type = "xs:string" ></ xs:element > </ xs:sequence > < xs:attribute name = "no" type = "xs:string" use = "required" ></ xs:attribute > </ xs:complexType > </ xs:element > </ xs:sequence > </ xs:complexType > </ xs:element > </ xs:schema > |
xml:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <? xml version = "1.0" encoding = "UTF-8" ?> < teaching-plan xmlns = "http://www.w3school.com.cn" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "plan.xsd" > < course no = "999" > < course-name >大学英语</ course-name > < class-hour >120</ class-hour > < exam-form >考试</ exam-form > </ course > < course no = "999" > < course-name >大学英语</ course-name > < class-hour >1</ class-hour > < exam-form >考试</ exam-form > </ course > </ teaching-plan > |
如果我的回答解决了你的疑惑,请采纳!祝学习愉快!
<?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>
<element name="class-hour">
<simpleType>
<restriction base="integer">
<minInclusive value="2"></minInclusive>
<maxInclusive value="110"></maxInclusive>
</restriction>
</simpleType>
</element>
<element name="exam-form" type="string"></element>
</sequence>
<attribute name="id" type="string" use="required"></attribute>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>
<?xml version="1.0" encoding="UTF-8"?>
<teaching-plan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="plan.xsd">
<course id="001">
<course-name>大学英语</course-name>
<class-hour>36</class-hour>
<exam-form>考试</exam-form>
</course>
<course id="002">
<course-name>高等数学</course-name>
<class-hour>70</class-hour>
<exam-form>考试</exam-form>
</course>
<course id="003">
<course-name>计算机应用基础</course-name>
<class-hour>70</class-hour>
<exam-form>上机考试</exam-form>
</course>
<course id="004">
<course-name>大学物理</course-name>
<class-hour>85</class-hour>
<exam-form>考试</exam-form>
</course>
</teaching-plan>
1 | < br > |
- 参与学习 人
- 提交作业 1088 份
- 解答问题 10204 个
如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧