首页
|
编程语言
|
网站建设
|
游戏天堂
|
冲浪宝典
|
网络安全
|
操作系统
|
软件时空
|
硬件指南
|
病毒相关
|
IT 认证
软讯网络
>
编程语言
>
C/C++
> 用XML实现的一个圣诞送贺卡分配页面
【标 题】:用XML实现的一个圣诞送贺卡分配页面
【关键字】:
XML
【来 源】:http://www.cppblog.com/riverbeast/archive/2006/12/24/16807.html
用XML实现的一个圣诞送贺卡分配页面
C++博客 - Dragon's Life-Studio - 用XML实现的一个圣诞送贺卡分配页面
Dragon's Life-Studio
The world puts off its mask of vastness to its lover ...
C++博客
::
首页
::
新随笔
:: ::
聚合
::
管理
::
66 随笔 :: 1 文章 :: 51 评论 :: 0 Trackbacks
<
2006年12月
>
日
一
二
三
四
五
六
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
公告
RiverBeast's Blog
Welcome to Dragon's Home
绿色的夏季变得如此轻柔
而流浪者的脚步声
响彻银色的天空
快乐是一种心情
也是一种态度
上帝只给了人有限的精力
却给了人无穷的欲望
相信你所相信的
选择你所选择的
只要是你认为正确的
你都没有理由轻言放弃
也许那片海洋很宽阔
以至于很多领域你都无法去探索
但是你要记得——
一粒沙中可以看见整个世界
一个果仁中可以透见整个宇宙
这时你就会明白
只要你不断挖掘自己的小岛并且胸怀整个大海
你也就知道了整个大海的真谛
水里的游鱼是沉默的
陆地上的兽类是喧闹的
空中的飞鸟是歌唱着的
但是——
人类却兼有海里的沉默 地上的喧闹与空中的音乐……
我们所期望的 并不是我们所做的
我们所做的 却有可能成为我们所期望的
神从创造中找到他自己
MSN
riverbeast_carlor at hotmail
随笔分类
Computer Life (27)
(rss)
Data Structure and Algorithms (4)
(rss)
English Learning (3)
(rss)
Mathematical Modeling (1)
(rss)
My Life (30)
(rss)
Programming (6)
(rss)
Science (1)
(rss)
XML JavaScript and PHP (2)
(rss)
随笔档案
2006年12月 (13)
2006年11月 (17)
2006年10月 (14)
2006年9月 (1)
2006年8月 (21)
文章分类
Computer-life (1)
(rss)
Social-Culture-Life (0)
(rss)
文章档案
2006年8月 (1)
相册
Avril Lavigne (15)
Some Pictures for Sharing (10)
About Me
del.icio.us
Share your Bookmarks there!
And maybe you can find a new and huge world there!
My PageFlakes
My PageFlakes!
The whole Web at your Fingertips!
My Web-Disk
Lots of good things you can find there! Just Help Youself!
Entertainment
One IQ-Testing Site
I got a pretty high score through the test! Haha!
Youtube
Broadcast yourself!
Has been adopted by Google with a pretty high price!
A bright future! Haha!
Friends
Diamrem's Home
A VERY HANDSOME GUY AND A VERY GOOD WRITER!
Have a look!
Juliet's MSN Space
Mainly about music and moives.
And also her life in HK.
跟着小徐混的Blog
From the same university but a different major.
Mainly on Daily-life, PHP-studing and Design.
My World
Ibiblio
The public's library and digital archive!
VeryCD Share the Internet!
You can download WHAT YOU CAN THINK OUT there....
WebMuseum
As the title - The WebMuseum!
奇迹文库
An Open-To-Public Scientific Knowledge-Base
Pretty Good Blogs
Omar's Blog
A MS MVP on VC# and also a good person!
Programming
CodeProject
The most wonderful Developer Site!
If you read one essay every day! You would be the MVP!
(Just for Joking,haha)
CSDN Community
Chinese Developer and Coder's Network!
MSDN
Wonderful Developer Site!
Sourceforge.net
OpenSource Sites!
搜索
积分与排名
积分 - 5993
排名 - 50
最新评论
1.?re: 一个短小精悍的用来删除其他计算机管理员的VBS脚本
@曾半仙
是呀 我后来也知道了可以这样做
只是当时在别人的机子上不好下载什么工具呵~~~
--江水兽
2.?re: 用XML实现的一个圣诞送贺卡分配页面
@张星
小亮子是谁呀?~~~
--江水兽
3.?re: 用XML实现的一个圣诞送贺卡分配页面
小亮子也来这看看吧!我感觉还不错的
--张星
4.?re: 用XML实现的一个圣诞送贺卡分配页面
看看
--张星
5.?re: 一个短小精悍的用来删除其他计算机管理员的VBS脚本
这是头痛砍脚啊.
选择将administrator在登陆界面显示即可.
微软提供的TweakUI->Logon->Show at Logon Screeen
--曾半仙
阅读排行榜
1.?数据结构中的若干基本术语和基本知识(332)
2.?Downloaded Installations文件夹中的文件不能随便删除呀(290)
3.?在Windows中模拟Linux的软件——Cygwin(248)
4.?S和P先生的问题编程求解(197)
5.?关于数据结构中凯特兰数列 (Catlan Numbers) 的证明和它在数据结构中的应用(189)
6.?一个短小精悍的用来删除其他计算机管理员的VBS脚本(162)
7.?Discover Dark Matter Evidence(151)
8.?关于无法访问LocalHost的一种另类情况的解决办法(144)
9.?慎重下载“娱乐黄金眼”客户端(132)
10.?用XML实现的一个圣诞送贺卡分配页面(125)
用XML实现的一个圣诞送贺卡分配页面
由于是第一次使用XML,所以留个纪念了!
Below is Christmas.xml
<?
xml?version="1.0"?encoding="UTF-8"
?>
<?
xml-stylesheet?type="text/xsl"?href="Arranging.xsl"
?>
????
<!
DOCTYPE?ChristmasDay?SYSTEM?"SendingCards.dtd"
>
????
<
SendingCardsToFriends
>
????????
<
title
>
Send?my?Christmas?Cards?Today!
</
title
>
????????
<
friends
>
????????????
<
type
>
Special?Friend
</
type
>
????????????
<
name
>
That?Wonderful?Girl
</
name
>
????????????
<
card
>
Christmas?Love?Card
</
card
>
????????
</
friends
>
????????
<
friends
>
????????????
<!--
Below?MFS?refers?to?my?Mother?Father?and?my?Sister
-->
????????????
<
type
>
Family?Member
</
type
>
????????????
<
name
>
MFS
</
name
>
????????????
<
card
>
Christmas?Family?Card
</
card
>
????????
</
friends
>
????????
<
friends
>
????????????
<
type
>
Normal?Friend
</
type
>
????????????
<
name
>
Omar
</
name
>
????????????
<
card
>
Christmas?Friendship?Card
</
card
>
????????
</
friends
>
????
</
SendingCardsToFriends
>
Below is Arranging.xsl
<?
xml?version="1.0"?encoding="UTF-8"
?>
<
xsl:stylesheet?
version
="1.0"
?xmlns:xsl
="http://www.w3.org/1999/XSL/Transform"
>
????
<
xsl:template?
match
="/"
>
????????
<
html
>
????????????
<
head
><
title
><
xsl:value-of?
select
="SendingCardsToFriends/title"
/></
title
></
head
>
????????????
<
body?
background
="MerryChristmas.jpg"
><
br
/><
br
/><
xsl:apply-templates?
select
="SendingCardsToFriends"
/></
body
>
????????
</
html
>
????
</
xsl:template
>
????
<
xsl:template?
match
="SendingCardsToFriends"
>
????????
<
h2?
align
="center"
><
font?
color
="olive"
><
xsl:value-of?
select
="title"
/></
font
></
h2
>
????????
<
xsl:for-each?
select
="friends"
>
????????????
<
div?
align
="center"
><
font?
size
="4pt"
>
????????????????What?I?send?to?my?
<
xsl:value-of?
select
="type"
/>
,?
<
xsl:value-of?
select
="name"
/>
?is?
<
xsl:value-of?
select
="card"
/>
.
????????????
</
font
></
div
><
br
/>
????????
</
xsl:for-each
>
????
</
xsl:template
>
</
xsl:stylesheet
>
Below is the Document-Type-Declaration file of the XML file
<?
xml?version="1.0"?encoding="UTF-8"
?>
????
<!
ELEMENT?SendingCardsToFriends?(title,friends)
>
????
<!
ELEMENT?titile?(#PCDATA)
>
????
<!
ELEMENT?friends?(type,name,card)
>
????
<!
ELEMENT?type?(#PCDATA)
>
????
<!
ELEMENT?name?(#PCDATA)
>
????
<!
ELEMENT?card?(#PCDATA)
>
初次使用XML,回顾一下——想当初还是在千千静听安装文件夹中看到 TTPlayer.xml 这个用于存放TTPlayer Config Items的文件时才意识到XML可以在软件编写中的作用——其实那时也只是一个朦胧的感觉,并不怎么清楚XML的作用,只是感觉很简单,只是一行XML的version声明和N行自定义的标记。
今天亲自使用了XML后,才感觉其实并非那么简单(尽管也不难),还是有一些默认的语法规则需要明确。(其实好像在软件设计中使用XML就没有什么要求了,只需利用XML来实现一个数据结构的串行化并且用XML解析器将其解析即可——纸上谈兵,我未亲自试过,估计大家应该比我有发言权多了吧……)
接着说一个需要注意的地方吧:
在xsl文件中,同样需要声明"version"属性,否则会出现IE解析错误(我在图书馆里借的一本书上没有"version"的声明,不知是书的作者不够严谨还是版本变化的缘故……)
<
xsl:stylesheet?
version
="1.0"
?xmlns:xsl
="http://www.w3.org/1999/XSL/Transform"
>
最后把我的页面实现效果贴出来:
注:需要全部文件的可以去
我的永硕网络空间
中的编程文档下载全部文件的压缩包A Example of XML and XSL.rar——高手或是稍微接触过一点XML的就不用下载了……
说明:使用IE打开xml文件便可以查看效果,用记事本便可查看源码,不过由于是采用ExchangerXML编写的文档,所以打开时会有格式上的混乱!因此,顺便在此推荐一下ExchangerXML -- A Java-written-Software?and also a?Freeware with pretty good fuctions, Strongly Recommended by RiverBeast!
posted on 2006-12-24 23:18
江水兽
阅读(125)
评论(3)
编辑
收藏
收藏至365Key
所属分类:
Computer Life
、
XML JavaScript and PHP
全排序
:【上一篇】
3D 引擎中的 GUI 渲染优化补完
:【下一篇】
【相关文章】
用.net 处理xmlHttp发送异步请求
如何存贮处理海量XML数据
使用证书对XML文档进行加解密
设置和验证XML文档的数字签名
xml notepad 2007 下载
.net精简框架集(WinCE平台下),XML反序列化成功与否与时间相关
嵌入式组态环境升级及XML反序列化慢的困惑
XSLT转换XML小结
OpenXml 与报表
XML+SQL=数据库的未来?
【随机文章】
光传送网的核心——光交叉连接
J2ee缩写名词解释
修改一个模拟163邮箱对话框代码的总结
最近在规划的一个开发项目管理系统
句柄和指针
构建自己的操作系统[2]-Loader
rpm命令参数列表
Webwork 2.2的Action是否使用Spring的prototype?获取的性能对比
ASP中时间函数的使用(三)
Excel开发(VSTO2005):简化工作表中选定区域的操作。
【相关评论】
没有相关评论
【发表评论】
姓名:
邮件:
随机码
*
:
评论
*
:
|
首 页
|
版权声明
| 联系我们
|
网站地图
|
CopyRight © 2004-2007
软讯
网络 All Rigths Reserved.