请问为什么起不到约束作用呢?

请问为什么起不到约束作用呢?

<?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="1" maxOccurs="999">
					<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="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">
	<!-- 这是注释作业1-10 -->
	<teaching-plan>
		<course id="001">
			<course-name>大学英语</course-name>
			<class-hour>20</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>108</class-hour>
			<exam-form>上机考试</exam-form>
		</course>
	</teaching-plan>

而且有两个报错怎么解决呢?http://img1.sycdn.imooc.com//climg/5e3591db099a158510500788.jpg

正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,起不到约束作用的原因是,xml编写的不正确,根标签<teaching-plan>已经编写了,所以下面的<teaching-plan>应该删除。

具体如下:

http://img1.sycdn.imooc.com//climg/5e36828f091f038210220377.jpg

如果我的回答解决了你的疑惑,请采纳!祝学习愉快!

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师