xml dtd css

本内容均为学习<<xml宝典(第二版)>>所得:
1.baseball.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="baseball.css"?>
<!DOCTYPE SEASON SYSTEM "baseball.dtd">
<SEASON>
<YEAR>2008</YEAR>
<LEAGUE>
<LEAGUE_NAME>West</LEAGUE_NAME>
<DIVISION>
</DIVISION>
</LEAGUE> 
  <LEAGUE>  
<LEAGUE_NAME>East</LEAGUE_NAME>
</LEAGUE>
</SEASON>

2.baseball.dtd
<!ELEMENT YEAR (#PCDATA)>
<!ELEMENT SEASON (YEAR,LEAGUE+)>
<!ELEMENT LEAGUE (LEAGUE_NAME,DIVISION*)>
<!ELEMENT LEAGUE_NAME (#PCDATA)>
<!ELEMENT DIVISION (#PCDATA)>
<!--"*" 零个或多个元素-->
<!--"+" 一个或多个元素-->
<!--"?" 零个或一个元素 也可以理解为有就唯一 -->

3.baseball.css
@CHARSET "UTF-8";
SEASON {display: block; font-size: 24px; }
LEAGUE {display: block;}

你可能感兴趣的:(xml,css)