xml元素
xml元素是可扩展的,彼此之间有关联。 xml元素的命名规则很简单。
xml元素是可扩展的
xml文档可以进行扩展以携带更多的信息。 请看下面的xml note 例子:
< note>
< to>tove< /to>
< from>jani< /from>
< body>don't forget me this weekend!< /body>
< /note>
想象一下,我们创建了一个应用程序,它把 < to>、< from>和< body>元素从 xml 文档中提取出来,生成了这样的输出:
message
to: tove
from: jani
don't forget me this weekend!
假如这个xml文档的作者又向其中增加了一些额外信息:
< note>
< date>1999-08-01< /date>
< to>tove< /to>
< from>jani< /from>
< heading>reminder< /heading>
< body>don't forget me this weekend!< /body>
< /note>
那么这个应用程序会不会出故障呢? 不会的,应用程序还是会从xml文档中找到< to>、< from>和< body> 元素而生成同样的输出。 xml文档是可以扩展的。
xml元素是彼此关联的
它们之间的关系就象父母与孩子之间的关系一样。要理解xml的术语,你就必须知道xml元素的命名和xml元素的描述之间的关系。 下面是一本书的描述:
book title: my first xml
chapter 1: introduction to xml
what is html
what is xml
chapter 2: xml syntax
elements must have a closing tag
elements must be correctly nested
下面的xml 文档对这本书进行描述:
< book>
< title>my first xml< /title>
< prod id="33-657" media="paper">< /prod>
< chapter>introduction to xml
< para>what is html< /para>
< para>what is xml< /para>
< /chapter>
< chapter>xml syntax
< para>elements must have a closing tag< /para>
< para>elements must be properly nested< /para>
< /chapter>
< /book>
在这里,book(书)是根元素,title 和 chapter(标题和章)是 book的子元素。 book 是title和chapter 的母元素。 title 和 chapter 则是兄弟元素 (或姐妹元素),因为它们的父母相同。
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器