XML 即可扩展标记语言(Extensible Markup Language),是一种平台无关的表示数据的方法。简单地说,使用 XML 创建的数据可以被任何应用程序在任何平台上读取。甚至可以通过手动编码来编辑和创建 XML 文档。其原因是,XML 与 HTML 一样,都是建立在相同的基于标记技术基础之上。
一个示例
比如说,假设我们想要使用 XML 存储关于某个事务的信息。这个事务是由销售人员的 iBook 发起的,因此您想把信息存储在 iBook 中。但是,信息稍后会发送给 Windows 服务器上的数据应用程序,并且最终保存在您的主机中,因此这需要极佳的灵活性才能完成。使用 XML 创建的数据内容如清单 1 所示。
清单 1. XML 示例
<?xml version="1.0"?><transaction ID="THX1138"> <salesperson>bluemax</salesperson> <order> <product productNumber="3263827"> <quantity>1</quantity> <unitprice currency="standard">3000000</unitprice> <description>Medium Trash Compactor</description> </product> </order> <return></return></transaction>
|
XML 将信息串行化并作为文本存储,这样数据便可以在任何可能需要的环境中使用。甚至不需使用特殊的应用程序,我们便可以看到内容(粗体显示)和标记(用于描述内容)。
继续学习
XML 的使用相当简单方便,当然前提是要理解 XML 的结构。XML 还提供了一些不同的方法,使用这些方法可以对数据的结构(甚至内容)进行控制。开始使用 XML 之后,您还会困扰于设计 XML 结构的最佳方式,不过这算不上复杂的过程。
XML Extensible Markup Language can be (Extensible Markup Language), is a platform-independent data said. In short, the use of XML data can be created by any application on any platform to read. Even through the manual coding to create and edit XML documents. The reason is that, XML and HTML, are built on the same basis based on the labeling.
An example
For example, suppose we want to use XML to store information on certain matters. The Service is the iBook sales initiated, so you want to store information in the iBook. However, the information will be sent to the Windows server data applications, and, ultimately, save your host, so it needs to complete an excellent flexibility. The use of XML to create data content, such as shown in a list.
List 1. XML example
<? xml version = "1.0"?>
<transaction ID="THX1138">
<salesperson> bluemax </ salesperson>
<order>
<product productNumber="3263827">
<quantity> 1 </ quantity>
<unitprice currency="standard"> 3000000 </ unitprice>
<description> Medium Trash Compactor </ description>
</ product>
</ order>
<return> </ return>
</ transaction>
XML serialization information as text and store, so that data can be in any environment that may be required to use. Even without the use of special applications, we will be able to see the content of the (bold) and markers (used to describe the content).
To continue learning
The use of XML is simple convenience, of course, the prerequisite is to understand the structure of XML. XML also provides a number of different ways, these methods can be used for data structure (and even the contents of) control. The beginning of the use of XML, you will be troubled by the structure of XML to design the best way, but not this complicated process.