XML课后练习答案(五)——XML文档编写小测验答案分享

题目:请用XML语言编写描述下面的学生成绩单的XML文档, 并请编写该XML文档的文档类型定义DTD。

注解:平均成绩那一栏是在xsl中用函数求的,在xml文档中只需要描述最基本结构即可,所以小伙伴看后面代码压根没有对这一栏的描述不用惊慌哦。这次分享是我自己的理解可能会有错误,欢迎反馈,我会及时更新哒^^

1、<?xml version="1.0" encoding="gb2312"?>

<students>

<student id="05001">

<name>张三</name>

<dept>计算机</dept>

<course id="001">

<title>编译方法</title>

<score>79</score>

</course>

<course id="002">

<title>C程序设计</title>

<score>85</score>

</course>

<course id="003">

<title>数据结构</title>

<score>93</score>

</course>

</student>

<student id="05002">

<name>李四</name>

<dept>数学</dept>

<course id="004">

<title>计算复杂性</title>

<score>72</score>

</course>

<course id="005">

<title>偏微分方程</title>

<score>86</score>

</course>

<course id="006">

<title>计算方法</title>

<score>95</score>

</course>

</student>

<student id="05003">

<name>王五</name>

<dept>化学</dept>

<course id="007">

<title>分子轨道理论</title>

<score>79</score>

</course>

<course id="008">

<title>有机化学</title>

<score>80</score>

</course>

<course id="009">

<title>分子生物学</title>

<score>88</score>

</course>

<course id="010">

<title>无机化学</title>

<score>98</score>

</course>

</student>

</students>

 

2、<?xml version = "1.0" encoding="GB2312"

standalone = "no"?>

  <!DOCTYPE students[

  <!ELEMENT students(student)*>

  <!ELEMENT student(name,dept,course*)>

  <!ELEMENT course(title*,score*)>

  <!ELEMENT student (#PCDATA)>

  <!ELEMENT name (#PCDATA)>

  <!ELEMENT dept (#PCDATA)>

  <!ELEMENT course(#PCDATA)>

  <!ELEMENT title (#PCDATA)>

  <!ELEMENT score (#PCDATA)>]>

  • 7
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值