就是不报错

就是不报错

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

<!-- <!DOCTYPE hr SYSTEM "hr.dtd"> -->

<hr xmlns:xsi="http://www.w3.org/2001/XML Schema-instance"

xsi:noNamespaceSchemaLation="hr.xsd">

<teching-plan>

<course id="001">

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

<course-hours>36</course-hours>

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

</course>

<course id="002">

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

<course-hours>70</course-hours>

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

</course>

<course id="003">

<course-name>计算机应用基础</course-name>

<course-hours>108</course-hours>

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

</course>

</teching-plan>

</hr>

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

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

targetNamespace="http://www.example.org/hr"

xmlns:tns="http://www.example.org/hr" elementFormDefault="qualified">

<element name="teching-plan">

<complexType>

<sequence>

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

<complexType>

<sequence>

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

<element name="course-hours">

<simpleType>

<restriction base="integer">

<minInclusive value="18"></minInclusive>

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

</restriction>

</simpleType>

</element>

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

</sequence>

</complexType>

</element>

</sequence>

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

</complexType>

</element>

</schema>


正在回答 回答被采纳积分+1

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

2回答
好帮手慕柯南 2019-09-02 10:04:42

同学你好!

  1. 第三和七行报错的原因是因为:

    没有hr这个标签哦,并且teching-plan放的位置不正确,正确的应该是:

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

    另外同学的no属性写错位置了哦,应该为course添加,而不是teching-plan

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

  2. hr.xsd同学改为自己的xsd名字就可以呢,老师这里用的是这个文件名,很抱歉,忘记改过来,给同学带来了疑惑,还望见谅

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

好帮手慕柯南 2019-09-01 19:05:18

同学你好!

不报错的原因是因为同学的两个文件的头部写错了呢

  1. xsd改为以下样子

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

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

	<element name="teching-plan">

		<complexType>

			<sequence>

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

					<complexType>

						<sequence>

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

							<element name="course-hours">

								<simpleType>

									<restriction base="integer">

										<minInclusive value="18"></minInclusive>

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

									</restriction>

								</simpleType>

							</element>

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

						</sequence>

					</complexType>

				</element>

			</sequence>

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

		</complexType>

	</element>

</schema>

2.xml改为以下样子:

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

	xsi:noNamespaceSchemaLocation="hr.xsd">

3.接下来同学可以看到报错了

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

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

  • 提问者 慕沐3362990 #1
    老师的回复里xml文件的第3,7行为什么会报错
    2019-09-01 19:21:40
  • 提问者 慕沐3362990 #2
    而且我把鼠标放在错号那里,并没有出现一些提示,这是为什么
    2019-09-01 19:24:12
  • 提问者 慕沐3362990 #3
    <hr xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hr.xsd">这一行里面的hr代表什么
    2019-09-01 19:32:00
问题已解决,确定采纳
还有疑问,暂不采纳

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

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

0 星
从网页搭建入门Java Web2018版
  • 参与学习           人
  • 提交作业       1088    份
  • 解答问题       10204    个

如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!

了解课程
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

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