xml一
XML准的址:http:www.w3.org/TR/REC-xml/
在有XML文件 ,均是由如下模成:
1.元素
2.性
3.
4.PCDATA(指文本)
5.CDATA(指原出的)
DTD文件是,元素明使用如下法:
<!ELEMENT 元素名 >或者
<!ELEMENT 元素名(元素容)>
例如:
<!ELEMENT 名 (#PCDATA)>
<!ELEMENT 籍 (名,格,明)>
空元素的明方法如下(用EMPTY字):
<!ELEMENT 元素名 EMPTY>
例如:
DTD中: <!ELEMENT br EMPTY>
XML中: <br/>
表示有任何容的元素(有ANY字)
例如:
DTD中:<!ELEMENT student ANY>
XML中:
<student></student>
<student><name></name></student>
DTD中,性通ATTLIST字明
法:<!ATTLIST 元素名 性名 性型 默值>
例子:
DTD中: <!ATTLIST payment type CDATA "cash">
XML中:
<payment type="check"/>
<payment/>
/************************* 考籍 ***********************/
Book Name: Beginning XML Databases
Author: Gavin Powell
Published Date: ? 2007 (490 pages)
ISBN:0471791202
Main Topic : With valuable exercises and step-by-step examples, this book will help you simplify your database work and provide a more standardized way to exchange data between multiple databases and web sites.
/****************************************************************/
/****================= Chapter 1: What is XML ====================*/
1. XSL:abbreviation for eXtensible Style Sheet
可展式表言的,功能如HTML的CSS式表一
2. The primary purpose of HTML is for display of data. XML is intended to describe data
HTML用示,XML用描述.
3. XML occupies less network bandwidth and involves less processing power
XMLHTML相比占用少的和存
4. XML was built to store and exchange data; HTML is designed to display data
XML是用存和交的,HTML是用示的.
5. All XML documents must have a single root node
所有的XML文件有且只有一根元素.
6. XML Schemas are a more advanced form of the DTD. XML Schemas can be used to define what and how everything is to
be created in an XML document.
7.The XML tag: The first line in an XML document declares the XML version in use and the encoding and
if is an isolated document only if in need:
<?xml version="1.0" encoding="UTF-8" standalone="yes/no"?>
Including style sheets: The optional second line contains a style sheet reference, if a style sheet is in use:
<?xml:stylesheet type="text/xsl" href="cities.xsl"?>
8.XML elements are case sensitive. HTML tags are not case sensitive
XML的和HTML不同,它大小是敏感的.
9.Like HTML tags, XML elements can have attributes. An XML element can have one or more name-value pairs,
and the value must always be quoted. HTML attribute values do not always have to be quoted, although it is advisable.
和HTML一,XML元素允有性值.一XML元素允有一或多的名值.和HTML不同的是,XML的性值必被指定.
10.Comments: Both XML and HTML use the same character strings to indicate commented out code:
<!-- This is a comment and will not be processed by the HTML or XML parser -->
XML和HTML的注解方法是一的都是用<!-- 是注解 -->的方式.但是注不能出在第一行的文件明之前.
11.Element naming rules: The names of elements (XML tags) can contain all alphanumeric characters
as long as the name of the element does not begin with a number or a punctuation character.
Also, names cannot contain any spaces. XML delimits between element names and attributes using a space character.
Do not begin an element name with any combination of the letters XML, in any combination of uppercase or lowercase
characters. In other words, XML_1, xml_1, xML_1, and so on, are all not allowed. It will not produce an error to use multiple
operative characters, such as + (addition) and (subtraction), but their use is inadvisable.
Elements least likely to cause any problems are those containing only letters and numbers. Stay away from odd characters.
元素命名:可以包含任何字或字母,不能用小或字,不允空格,不允以XML的字串作元素名,如xml_1,XML_2等,
都是非法的.算字符最好不要包括在其中(如"+","-"等),然法上是可以的,但不推使用.所以最好只用字母或字命名元素.
XML用空格分元素名和它的性.
12.Relationships between elements: The root node has only children.
All other nodes have one parent node, as well as zero or more child nodes.
13.XML namespaces allow for the making of distinctions between different XML documents that have the same elements.
如果在不同XML文件中需要存在多相同的,可以出突,可以采用命名空分它.
14.Different browsers and browser versions will behave differently with XML.
不同的器及其版本XML的解析可能有差.
於(xml data islands)
是一可以利用<xml>嵌入到html代:Beginning XML Databases一文中有提到:
XML documents can also be displayed in a browser using an XML data island. An XML data island is an XML document (with its data) directly or indirectly embedded inside an HTML page. An XML document can be embedded inline inside an HTML page using the HTML <XML> tag. It can also be referenced with an HTML SRC attribute.
例代如下:
<HTML><BODY><XML ID="xmlParts"> <?xml version="1.0"?> <parts> <part> <partnumber>X12334-125</partnumber> <description>Oil Filter</description> <quantity>$24.99</quantity> </part> <part> <partnumber>X44562-001</partnumber> <description>Brake Hose</description> <quantity>$22.45</quantity> </part> <part> <partnumber>Y00023-12A</partnumber> <description>Transmission</description> <quantity>$8000.00</quantity> </part> </parts></XML><TABLE DATASRC="#xmlParts"><TR> <TD><DIV DATAFLD="partnumber"></DIV></TD> <TD><DIV DATAFLD="$text"></DIV></TD></TR></TABLE></BODY></HTML>
/****========== 2008年11月30日 ==== end of Chapter 1 ====*/