• 热门标签

当前位置: 主页 > 航空资料 > 国外资料 >

时间:2010-08-23 16:10来源:蓝天飞行翻译 作者:admin
曝光台 注意防骗 网曝天猫店富美金盛家居专营店坑蒙拐骗欺诈消费者

FODM – Introduction to XML 27/44
XML DTD
XML provides an application independent way of sharing data.
 With a DTD, independent groups of people can agree to use a common DTD for
interchanging data.
 Your application can use a standard DTD to verify that data that you receive
from the outside world is valid.
 You can also use a DTD to verify your own data.
Like DTD, XML Schema is another way of describing the XML data structures.
The W3C seems to foresee XML Schemas as a replacement for DTDs. But for now,
DTD are largely used.
The purpose of a DTD is to define the legal building blocks of an
XML document.
It defines the document structure with a list of legal elements.
FODM – Introduction to XML 28/44
The DTD is interpreted like this:
!ELEMENT contact (in line 2) defines the element
“contact" as having one element: “name".
!ELEMENT name (in line 3) defines the element
“name” as having two elements: “firstname and
“surname".
!ELEMENT firstname and surname (in line 4-5)
defines the elements to be of the type "CDATA“
XML DTD
External Reference
<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd">
<contact>
<name>
<firstname>Ronan</firstname>
<name>O'Gara</name>
</name>
</contact>
<?xml version="1.0"?>
<!ELEMENT contact (name)>
<!ELEMENT name (firstname,surname)>
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT surname (#PCDATA)>
A DTD can be declared as an external reference.
 External reference is done by calling an external file. It will contain the legal
elements. It will be called from a local link or by acceding by its URL.
FODM – Introduction to XML 29/44
<?xml version="1.0" encoding="ISO-8859-1"?>
<contact>
<name>
<firstname>Ronan</firstname>
<name>O'Gara</name>
</name>
</contact>
"Well Formed" XML
is a document that conforms to the XML
syntax rules
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE note SYSTEM "note.dtd">
<contact>
<name>
<firstname>Ronan</firstname>
<name>O'Gara</name>
</name>
</contact>
"Valid" XML
is a "Well Formed" XML document,
which also conforms to the rules of a
Document Type Definition (DTD)
Note: Errors in XML documents will stop the XML program
–The W3C XML specification states that a program should not continue to process an XML
document if it finds a validation error
–The reason is that XML software should be easy to write, and that all XML documents should be
compatible
XML Validation
FODM – Introduction to XML 30/44
DTD and instance
ATA Chapter
Section
Description
+
Illustration
Graphic Description
Revision Mark
ELEMENTS
FCOM
FODM – Introduction to XML 31/44
DTD and instance
Pagination
Revision Number
Item Number
Type of “Equation”
ATTRIBUTES
FODM – Introduction to XML 32/44
http://www.w3.org/XML/
http://www.xml.org/
http://www.w3schools.com/
Further reading
FODM – Introduction to XML 33/44
XML Structure - Quiz
True
Is it a “well formed” xml document?
False
<?xml version="1.0"?>
<web site>
<name>Airbus</name>
<desc>Site Corporate Airbus
<url>http://www.airbus.com
<lastvisit>30/03/2006<lastvisit>
</web site>
The tags of an XML Element
should be closed.
A
B
FODM – Introduction to XML 34/44
XML Structure - Quiz
True
Is it a “well formed” xml document?
False
<?xml version="1.0"?>
<name>Airbus</name>
<desc>Site Corporate Airbus</desc>
<url>http://www.airbus.com</url>
<lastvisit>30/03/2006<lastvisit>
An XML Document should have
a root element.
A
B
FODM – Introduction to XML 35/44
XML Structure - Quiz
True
Is it a “well formed” xml document?
False
<?xml version="1.0"?>
<website>
<name>Airbus</name>
<desc>Site Corporate Airbus</desc>
 
中国航空网 www.aero.cn
航空翻译 www.aviation.cn
本文链接地址:FODM Training(5)