xml简单实例

来源:互联网 发布:ie缓存中js被篡改 编辑:程序博客网 时间:2024/05/29 16:07

se.xml文件

<?xml version = "1.0" encoding="GB2312"?>
<?xml-stylesheet type="text/css" href="se.css" ?>
<selist>

  搜索引擎列表

<se>

<name>百度</name>

<site>www.baidu.com </site>

</se>

<se>

<name>谷歌</name>

<site>www.google.com </site>

</se>

</selist>

 

se.css文件

selist, se

{

  font-size:20pt;

  font-weight:bold;

  color:blue;

  display:block;

  margin-bottom:20pt;

  margin-top:20pt;

}

 

name

{

  font-weight:bold;

  font-size:12pt;

  display:block;

  color:red;

  margin-left:20pt;

}

 

site

{

  font-weight:bold;

  font-size:12pt;

  display:block;

  color:black;

  margin-left:20pt;

}

 

song.xml文件

<?xml version="1.0" encoding="gb2312"?>
<!--文件使用song.css层叠样式单-->
<?xml-stylesheet type="text/css" href="song.css"?>
<!DOCTYPE songlist[
<!ENTITY desc1 "something between two lover">                    //实体声明,放在DOCTYPE中
<!ENTITY desc2 "a smart boy in a girl's eyes">
]>

<songlist>
 <song>
 <title>&lt; Don't say goodby &gt;</title>
 <author xml:space='preserve'>谭 咏 麟</author>
 <rhythm>4/4</rhythm>
 <country>hongkong China</country>
 <brief>&desc1; </brief>                                    //实体引用
 </song>
 
 <song>
 <title>&lt; Dancing Boy &gt;</title>
 <author xml:space='preserve'>林 震 强</author>
 <rhythm>&amp; 4/4</rhythm>
 <country>Japan</country>
 <brief>&desc2; </brief>
 </song>
</songlist>

 

song.css文件

songlist{display:block;}
song{display:block;}
song{
 display:block;
 background-color:white;
 color-red;
 position:relative;
 left:120px;
 }
title{
 display:block;
 font-family:Arial,Helvetica,sans-serif;
 font-size:large;
 font-style:italic;
 color:green;
 }
author{
 display:block;
 font-weight:bold;
 font-family:fantasy;
 color:red;
 }
rhythm{
 display:block;
 font-weight:bold;
 font-style:italic;
 font-size:30;
 color:red;
 }
country{
 display:block;
 font-family:fantasy;
 color:red;
 position:relative;
 top:200px;
 width:100px;
 height:60px;
 }
brief{
 font-family:fantasy;
 display:block;
 color:red;
 }

原创粉丝点击