XML Basics

XML Basics & DTD 1、熟悉和掌握XML规范的基本内容,包括XML声明、注释、处理指令、元素、属性、CDATA段、预定义实体、命名空间的使用,以及如何进行XML文档良构和有效性验证;能够灵活地使用XML层次数据来表示各种信息。 2、掌握如何在DTD文档中声明元素及其内容模型、属性,以及实体的声明和使用;使用内部/外部DTD规则,对XML数据文档的有效性进行约束。 立即下载

Before making/editing XML, lets first learn what it is. That begins with understanding why XML is; why does it exist? Basically, XML was created to serve as an easily usable, readable method to format information within an basic text file. What it does is allows you to contain information (text/numbers) in a hierarchal manner. This means one bit of information can serve as a type of file folder for holding more information.

In fact, you can think of XML just as that, as a text write-out of a hierarchical file system. It is NOT a script and does NOT "do" anything. It just provides information in an outlined and logically laid out manner.

For more information beyond laymens terms, see:
http://www.xml.com/
http://www.w3.org/XML/


XML structure
Looking at XML, you'll notice it looks a lot like HTML. In a way, HTML is a type of XML (though it was around before XML was) but the structure is in many cases the same. Here's a simple example of an XML file:

<LETTER>
 <TO>Sandy</TO>
 <FROM>Joseph</FROM>
 <BODY>I love you!</BODY>
</LETTER>

Its fairly easy to see what information this XML file holds and how its laid out. In the file folder metaphor, this represents a folder called LETTER which contains 3 other folders TO, FROM and BODY. Each one of those folders contains the given text. The folder TO for example has "Sandy" in it.

The XML itself is made up primarily of 2 things, Nodes and Attributes. Each one of these are containers for information, though attributes are special in that they are contained only within nodes. In the example above, each one of the 'folders' (ie LETTER, TO, etc.) are a node. Nodes, as the name suggests, are containers which can hold textual information (in Attributes) as well as have within them other nodes as seen above. Its this encapsulation which makes up the hierarchy of a XML file defining its structure.

There are no attributes in the LETTER XML example, and often attributes aren't used at all. However, they can be useful in specifying properties or little tid-bits of information within a given node. Here is an example that uses attributes:

<THURSDAY>
 <MEETING TIME="10:00">
  The meeting was boring. I made paper airplanes with a memo I recieved earlier.
 </MEETING>
 <LUNCH TIME="1:30">
  John came over to talk to me.  He smells funny today.
  <SERVED MAINCOURSE="Steak" SIDE1="Apple" SIDE2="Mustard" DRINK="TANG" />
  <SPENT MEALCARD="0" CASH="12.00" />
 </LUNCH>
</THURSDAY>

MEETING, for example, contains the attribute TIME. TIME's value is 10:00. In HTML attributes would be like the href or target options within an anchor <a></a> tag. TIME just gives you a way to specify some extra information which is associated directly with that node.

The above example demonstrates two other things:

  1. Nodes with out any child nodes, or nodes within it, can be terminated within their own tag using /> instead of re-writing the tag over again in closing tag. For example, <NODE1></NODE1> can be instead be written as <NODE1/>. This is seen with the SERVED and SPENT nodes within LUNCH.
     

  2. You can see how the text in the LUNCH node - "John came over to talk to me. He smells funny today." - sits pleasantly with the other nodes SERVED and SPENT. This is because that text is itself a node. Its a text node. It doesn't have any bracket tags nor any attributes or child nodes (folders in itself). All it is is just text - its a text node! The first example also had text nodes. "Sandy", "Joseph" and "I love you!" were all text nodes. Non-text nodes can also be referred to as "Elements".

Hopefully, for those of you who didn't know anything or knew little about XML, this cleared some things up or gave you an idea on how to perceive XML. Feel free to post any questions you may have on the forums.

XML》实验(1) -- XML Basics & DTD [实验目的] 1、安装并学习如何使用XMLSPY集成开发环境完成XML相关的开发工作。 2、熟悉和掌握XML规范的基本内容,包括XML声明、注释、处理指令、元素、属性、CDATA段、预定义实体、命名空间的使用,以及如何进行XML文档良构和有效性验证;能够灵活地使用XML层次数据来表示各种信息。 3、掌握如何在DTD文档中声明元素及其内容模型、属性,以及实体的声明和使用;使用内部/外部DTD规则,对XML数据文档的有效性进行约束。 某软件学院XML课程实验答案 立即下载

相关推荐

The Definitive Guide to Berkeley DB XML

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。http://blog.csdn.net/topmvp - topmvpThe Definitive Guide to Berkeley DB XML covers Sleepycats Berkeley DB XML, an open source embedded XML datab

TopMVP 487

JAXB2 Basics:提升JAXB2使用体验的强大工具集

JAXB2 Basics:提升JAXB2使用体验的强大工具集 JAXB2 Basics 是一个开源项目,主要使用 Java 编程语言开发。该项目旨在为 Java Architecture for XML Binding (JAXB) 2 提供一系列实用的插件和工具,以简化 JAXB 的使用过程并扩展其功能。 核心功能 JAXB2 Basics 的核心功能包括但不限于以下几点: SimpleEqu...

gitblog_00900的博客 566

JAXB2 Basics 项目使用教程

JAXB2 Basics 项目使用教程 1. 项目的目录结构及介绍 JAXB2 Basics 项目的目录结构如下: jaxb2-basics/ ├── github/ │ └── workflows/ ├── basic/ ├── dist/ ├── plugins/ ├── runtime/ ├── samples/ ├── testing/ ├── tests/ ├── tools/ ├─...

gitblog_01165的博客 411

JAXB2 Basics 开源项目使用教程

JAXB2 Basics 开源项目使用教程 1. 项目介绍 JAXB2 Basics 是一个开源项目,旨在为 JAXB 2.x 参考实现提供有用的插件和工具。JAXB(Java Architecture for XML Binding)是一个用于将 Java 对象与 XML 数据进行相互转换的框架。JAXB2 Basics 项目通过提供一系列插件,增强了 JAXB 的功能,例如生成 equals ...

gitblog_00226的博客 476

Print.Print Bookmark with del.icio.us XML Basics for Java Developers, Part 1

Every now and then, an idea comes along that in retrospect seems just so simple and obvious that everyone wonders why it hadnt been seen all along. Often when that happens, it turns out that the

纯冰蓝色的BLOG 1519

Maven的pom.xml文件详解------The Basics

Maven坐标 GroupId、artifactId和version构成了Maven的坐标(groupId和version可以从parent继承),指定了组件在Maven仓库中的位置。Maven中的每个组件都有一个坐标,通过这个坐标我们在自己的项目中可以设置对该组件的依赖。  ------groupId:项目属于哪个组,往往和项目所在的组织或公司存在关联;  ------artifactId

宁静致远 7011

JAXB2 Basics 项目常见问题解决方案

JAXB2 Basics 项目常见问题解决方案 项目基础介绍 JAXB2 Basics 是一个开源项目,提供了一系列针对 JAXB 2 的实用插件和工具。这些插件和工具旨在简化 JAXB 的使用过程,提高开发效率。JAXB(Java Architecture for XML Binding)是一个用于将 Java 对象与 XML 数据之间进行映射的 API。该项目主要使用 Java 编程语言。 新...

gitblog_00630的博客 827

IDEA 创建 MAVEN 父子工程

IDEA 创建 MAVEN 父子工程 1、参考资料 IDEA 创建MAVEN父子项目 使用IDEA创建maven父子工程 使用IDEA创建maven父子工程项目 2、创建 Maven 父工程 选择新建 Maven 工程 输入该项目的【GroupId】和【ArtifactId】,点击【Finish】完成父工程的创建 3、创建 Maven 子工程 父工程中不会存放源代码,因此其 src 目录可以删掉,在父工程上右击,选择【New】–>【Module】 又来到 Ma

Oneby的博客 397

[xml]DTD & XML

ToveJaniReminderDont forget me this weekend!    

簡單筆記 676

Elm Core Libraries源码解读:从Basics到Platform的实现细节

探索Elm编程语言的核心库实现细节,了解从基础运算到平台架构的完整设计思路。作为每个Elm项目的必备依赖,core74/core库提供了函数式编程的基础构建块。 ## 📚 Elm核心库概览 Elm核心库是每个Elm项目的基石,包含了从基本数学运算到复杂数据结构的完整功能集。通过分析源码结构,我们可以深入了解Elm语言的设计哲学和实现机制。 **核心模块包括:** - **Basics.el

gitblog_00840的博客 933

xml的基本学习

1、 XML的概念 允许开发者自由定义标签,侧重于数据如何存储和传输,跨平台的数据交换格式,一种轻量级的持久化方案。 XML文档必须遵守基本规范,同时一份有效的文档,还必须遵守语义约束 a) 只有一个根元素 b) 元素必须合理结束 c) 元素之间必须合理嵌套 d) 元素的属性必须要有值 2、 Xml声明 XML声明向解析器提供了关于该文档的基本信息 Encoding:指定对该...

zhoulin1239的博客 172

Protocol Buffer Basics

Reference:https://developers.google.com/protocol-buffers/docs/overview What are protocol buffers? Protocol buffers are a flexible, efficient, automated mechanism for serializing structured d...

delengyao1368的博客 157

Basics of Apache Ant

what is Ant? (Ant是什么) Apache Ant is a Java-based build tool whose mission is to drive processes described in build files as targets and extension points dependentupon each other.(Ant uses XML to

超悦 廊坊师范学院七期信息技术提高班 1277

Compose Basics - MAD Skills

【代码】Compose Basics - MAD Skills。

YuanTingWuJi的博客 1563

XSLT Basics

<br /><br />http://www.learn-xslt-tutorial.com/<br /> eXtensible Stylesheet Language<br />The eXtensible Stylesheet Language is divided into two sub-languages: eXtensible Stylesheet Language Transformations (XSLT) and eXtensible Stylesheet Language - Forma

221

RESTful Web services: The basics

The basics Develop skills on this topic This content is part of a progressive knowledge path for advancing your skills. SeeBuild RESTful web services with Java technology REST defines a

caoguanling2011的专栏 802

Web Application Basics

7.18

Sdinosaur2的博客 176

maven basics

create new projectmvn archetype:generate -DartifactId=weather -DgroupId=org.liuf.weather -Dversion=1.0 buildmvn install build jar with dependencypom.xmlbuild plugins pluginartifact

Frank 337
上一篇: 网页内容截取组件V1.0
下一篇: HTML标记
ericsone
博客等级 码龄22年 26粉丝 27原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值