• 热门标签

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

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

<comment>
He’s a great rugby player!
</comment>
<comment>
He’s a great
rugby
player!
</comment>
Will be displayed when
published :
He’s a great rugby player!
OR
The content is not linked to
the presentation
FODM – Introduction to XML 15/44
contact is the root element.
<?xml version="1.0" encoding="ISO-8859-
1"?>
<contact>
<name>
<firstname>Ronan</firstname>
<surname>O'Gara</surname>
</name>
<email>
<id>ronan.o-gara </id>
<server>mail.com</server>
</email>
<address>
<street>26 O'Connell St</street>
<postcode>27 011</postcode>
<town>Dublin</town>
<country>Ireland</country>
</address>
<comment>This is a great friend of…
</comment>
</contact>
Contact:
Ronan O'Gara
Email: ronan.ogara@
mail.com
26 O'Connel St
Dublin, Ireland
Contact
XML Elements - Examples
contact is the parent element of name,
email, address and comment.
name, email, address and comment are
siblings (or sister elements) because they
have the same parent. XML File
FODM – Introduction to XML 16/44
<?xml version="1.0" encoding="ISO-8859-
1"?>
<contact>
<name>
<firstname>Ronan</firstname>
<surname>O'Gara</surname>
</name>
<email>
<id>ronan.o-gara </id>
<server>mail.com</server>
</email>
<address>
<street>26 O'Connell St</street>
<postcode>27 011</postcode>
<town>Dublin</town>
<country>Ireland</country>
</address>
<comment>This is a great friend of…
</comment>
</contact>
XML Elements
Elements must be properly nested.
To understand XML terminology, you have to
know how relationships between XML
elements are named, and how element
content is described.
XML File
Elements must have a closing tag.
XML Elements have hierarchical relationships
as parents and children and siblings.
FODM – Introduction to XML 17/44
XML Elements
Content type:
An XML element is everything from (including) the element's start tag to
(including) the element's end tag
An element can have element content,
mixed content,
simple content,
or empty content.
An element can also have attributes
FODM – Introduction to XML 18/44
<?xml version="1.0" encoding="ISO-8859-
1"?>
<contact>
<name> Name of the contact
<firstname>Ronan</firstname>
<surname>O'Gara</surname>
</name>
<email>
<id>ronan.o-gara </id>
<server>mail.com</server>
</email>
<address>
<street>26 O'Connell St</street>
<postcode>27 011</postcode>
<town>Dublin</town>
<country>Ireland</country>
</address>
<comment cat=“friends”></comment>
</contact>
XML Elements
Name has mixed content because it
contains both text and other elements.
In the example:
contact has element content, because it
contains other elements.
XML File
FODM – Introduction to XML 19/44
<?xml version="1.0" encoding="ISO-8859-
1"?>
<contact>
<name> Name of the contact
<firstname>Ronan</firstname>
<surname>O'Gara</surname>
</name>
<email>
<id>ronan.o-gara </id>
<server>mail.com</server>
</email>
<address>
<street>26 O'Connell St</street>
<postcode>27 011</postcode>
<town>Dublin</town>
<country>Ireland</country>
</address>
<comment cat=“friends”></comment>
In the example only the comment element has </contact>
attributes:
–The attribute named “cat” has the value
“friends“.
XML Elements
Name has mixed content because it
contains both text and other elements.
id has simple content (or text content)
because it contains only text.
Comment has empty content, because it
 
中国航空网 www.aero.cn
航空翻译 www.aviation.cn
本文链接地址:FODM Training(3)