4. 2. What is XML?
XML is primarily for descriptive markup.
presentational Mobile phones:
Nokia 8890
Ericsson A3618
procedural <document>
<newPage style="box"/>
<bold>Mobile phones:</bold>
<list>
<newItem/><italic>Nokia 8890</italic>
<newItem/><italic>Ericsson A3618</italic>
</list>
</document>
descriptive (the previous example)
Classes of text markup
4
6. XML документын бүтэц
<person type=“Friend”>
<name>Ortal Derech</name>
<tel>04-8732122</tel>
<tel>054-646888</tel>
<email>oderech@tx.technion.ac.il</email>
</person>
элемент
элемент, дэд элемент
атрибут
текст
6
14. 1. Why XML evolved
1986 SGML (Standard Generalized Markup Language) for
defining and representing structured documents
1960-1980 Infrastructure for the Internet
1991 WWW and HTML introduced for the Internet
1991 Business adopts the WWW technology; huge
expansion in the use of the Internet
Urgent need for a new, common data format for the
Internet
1995 New kinds of businesses evolve, based on the
connectivity of people all over the world and connectivity
of applications built by various software providers
14
17. Нэмж судлах сэдвүүд
XPath
• XML Path Language. XML файлаас өгөгдөл
өгөгдөл хайхад хэрэглэгддэг хэл.
<?xml version="1.0" encoding="ISO-
8859-1"?>
<bookstore>
<book>
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
Path Expression Result
bookstore Selects all the child nodes of the bookstore
element
/bookstore Selects the root element bookstoreNote: If
the path starts with a slash ( / ) it always
represents an absolute path to an element!
bookstore/book Selects all book elements that are children of
bookstore
//book Selects all book elements no matter where
they are in the document
bookstore//book Selects all book elements that are
descendant of the bookstore element, no
matter where they are under the bookstore
element
17
22. Гүйцэтгэх даалгавар
• person.xml файлыг уншиж дараах байдлаар
хэвлэдэг болгох
------------------------------------------
Person info
Total count: 3
Names:
Person 1: Lars
Person 2: Lars
Person 3: Landerman
Lars count: 2
--------------------------------------------
Хэвлэж харуулахад ашиглагдах статик текстүүдийг ногооноор тэмдэглэлээ.
22