Presentation is loading. Please wait.

Presentation is loading. Please wait.

eXtensible Markup Language (XML)

Similar presentations


Presentation on theme: "eXtensible Markup Language (XML)"— Presentation transcript:

1 eXtensible Markup Language (XML)
Objectives Introduction XML overview through a practical example XML syntax Elements and attributes to mark up data XML parser -- A well-formed XML document Markup text vs. character data CDATA sections XML namespace XML applications XML related technologies

2 Introduction eXtensible Markup Language (XML)
A description of XML from W3C school: XML is a cross-platform, software and hardware independent tool for transmitting information. Technology for creating markup languages Enables document authors to describe data of any type Allows creating new tags HTML limits document authors to fixed tag set Example: <body>, <p>, <h1>……etc. A new tag, such as car type, compares to an HTML tag method <carType>4-door</carType> vs. <h2>4-door</h2>

3 Introduction (cont.) How can XML be used?
XML can Separate Data from HTML With XML, your data is stored outside your HTML. with HTML, data is stored inside your HTML. With XML, data can be stored in separate XML files. Concentrate on using HTML for data layout and display XML data can also be stored inside HTML pages as "Data Islands". XML is used to Exchange Data With XML, data can be exchanged between incompatible systems. Challenge: transmitting data in incompatible formats over the Internet Converting the data to XML can greatly reduce this complexity and create data that can be read by many different types of applications.

4 Introduction (cont.) How can XML be Used?
XML and Business To Business (B2B) Financial information can be exchanged over the Internet. Expect to see a lot about XML and B2B in the near future. The main exchanging language for exchanging financial information between businesses over the Internet. A lot of interesting B2B applications are under development. XML can be used to Share Data Plain text files can be used to share data. XML in plain text format, a software- and hardware-independent. Easier to create data for different applications Easier to expand or upgrade a system to new operating systems, servers, applications, and new browsers. 

5 Introduction (cont.) How can XML be Used?
XML can be used to Store Data Plain text files can be used to store data. XML can also be used to store data in files or in databases. XML can make your Data more Useful Your data is available to more users. Make your data available to other than only standard HTML browsers. Other clients and applications can access your XML files as data sources, like they are accessing databases. Data can be made available to all kinds of "reading machines" (agents), and it is easier to make your data available for blind people, or people with other disabilities.

6 Introduction (cont.) How can XML be Used?
XML can be used to Create new Languages XML is the mother of WAP and WML. The Wireless Markup Language (WML), used to markup Internet applications for handheld devices like mobile phones, is written in XML. Wireless Application Protocol (WAP) If Developers have Sense (Sky is the limit!) If “we” DO have sense, all future applications will exchange our data in XML Word processors, spreadsheet applications and databases that can read each other's data in a pure text format, without any conversion utilities in between. We can only pray that Microsoft and all the other software vendors will agree.

7 XSL, CSS, embedded in HTML… etc.
Introduction (cont.) An overview and structure diagram to present the idea of XML and its applications XML Applications XSL, CSS, embedded in HTML… etc. XML document Presentation Of XML Doc.

8 An XML Example XML does not DO anything
XML was not designed to DO anything. XML was created to structure, store and to send information. The following example is a note to Class from Wei, <note> <to> TO: Class of Web Programming</to> <from> From : Wei</from> <heading> *** Reminder ***</heading> <body>Don't forget me this Friday!</body> </note> The note has a header and a message body. It also has sender and receiver information. But still, this XML document does not DO anything. It is just pure information wrapped in XML tags. Someone must write a piece of software to send, receive or display it.

9 But, How to present the data in the XML file
But, How to present the data in the XML file? Using eXtensible Stylesheet Language (XSL) <?xml version = "1.0"?> <xsl:stylesheet version = "1.0" xmlns:xsl = " <xsl:template match = "note"> <head> <title><xsl:value-of select = "heading"/></title> </head> <body bgcolor = "white"> <h1><xsl:value-of select = "from"/></h1><br></br> <h1><xsl:value-of select = "to"/></h1> <h2><xsl:value-of select = "heading"/></h2> <p style = "font-size: 20pt; color:#0000ff">xsl:value-of select = "body"/></p> </body> </xsl:template> </xsl:stylesheet> XML Presentation

10 Present data in XML file: with CSS
With CSS (Cascading Style Sheets) you can define display information to an XML document In the XML file: <?xml-stylesheet type="text/css" href=“example1_2.css"?> Same as normal CSS definition note { background-color: #ffffff; width: 100%; } CSS file XML Presentation

11 Present data in XML file: XML in DataIsland
IE5.0 or higher, XML can be embedded within HTML pages in Data Islands ( Unofficial <xml> tag, declare in the tag <body> <xml id="note" src="example1_3.xml"></xml> Data Islands can be bound to HTML elements <table>, <span>,<div> through attributes: “datasrc” & “datafld” , refers to the example XML Presentation

12 Introduction to XML Markup
XML document (intro.xml) Marks up message as XML Commonly stored in text files Extension .xml Must contain exactly one root element Attempting to create more than one root element is erroneous All other elements must be within this root element

13 <subchild>.....</subchild> </child> </root>
Document begins with declaration that specifies XML version 1.0 1 <?xml version = "1.0"?> 2 3 <!-- Fig. 5.1 : intro.xml > 4 <!-- Simple introduction to XML markup --> 5 6 <myMessage> 7 <message>Welcome to XML!</message> 8 </myMessage> Line numbers are not part of XML document. We include them for clarity. Comments Fig. 5.1 Simple XML document containing a message. Line numbers are not part of XML document. We include them for clarity. Document begins with declaration that specifies XML version 1.0 Comments Element message is child element of root element myMessage Element message is child element of root element myMessage <root> <child> <subchild>.....</subchild> </child> </root>

14 Char. Encoding (Latin-1/West European)
XML syntax The syntax rules of XML are very simple and very strict. The rules are very easy to learn, and very easy to use. An example: <?xml version="1.0" encoding="ISO "?> <note> <to>To: Class of Web Programming (II)</to> <from>From: Wei</from> <heading>*** Reminder ***</heading> <body>Don't forget me this Friday!</body> </note> XML version & Char. Encoding (Latin-1/West European) root element Child elements Data content

15 XML Syntax (cont.) All XML elements Consists of
Start tag: <message> Content(may or may not) : Welcome to XML! End tag : </message> All elements must have corresponding end tag Example: <img src = “img.gif”> is correct in HTML, but not XML XML requires end tag or forward slash (/) for termination <img src = “img.gif”></img> or <img src = “img.gif”/> is correct XML syntax

16 XML Syntax (cont.) XML tags are case sensitive
The tag <Letter> is different from the tag <letter> Opening and closing tags must therefore be written with the same case: <Message>This is incorrect</message> <message>This is correct</message> All XML elements must be properly nested Improper nesting of tags makes no sense to XML Incorrect: <x><y>hello</x></y> Correct: <x><y>hello</y></x>

17 XML Syntax (cont.) Comments in XML There is nothing special about XML
The syntax for writing comments in XML is similar to that of HTML. <!-- This is a comment --> There is nothing special about XML It is just plain text with the addition of some XML tags enclosed in angle brackets, like HTML An software that can handle plain text can also handle XML. In a simple text editor, the XML tags will be visible and will not be handled specially. In an XML-aware application, however, the XML tags can be handled specially. i.e. Spy, .net The tags may or may not be visible, or have a functional meaning, depending on the nature of the application.

18 Markup Elements XML Elements are extensible
Authors are free to extend the elements without worrying the crash of document Example: add 2 or 3 tags to the example1_1.xml XML Elements have relationships Elements are related as parents and children Example: the content of a book: How I Play Golf Introduction to golf  What is golf  What are clubs Short Game  What is short game  Which club should be used

19 Markup Elements (cont.)
<book> <title>How I Play Golf</title> <prod id="33-657" media="paper"></prod> <chapter>Introduction to golf <para>What is golf</para> <para>What are clubs</para> </chapter> <chapter>Short Game <para>What is short game</para> <para>Which club should be used</para> </book> Root element? child elements? Parent element? Sibling elements?

20 Markup Elements (cont.)
Element Content Element content, mixed content, simple content, or empty content Element Naming Rules Names can contain letters, numbers, and other characters Names must not start with a number or punctuation character Names must not start with the letters xml (or XML or Xml ..) Names cannot contain spaces

21 Markup Elements (cont.)
Element Naming Rules (cont.) Any name can be used, no words are reserved, but the idea is to make names descriptive Element names can be as long as you like Non-English letters like éòá are perfectly legal in XML element names, but watch out for problems if your software vendor doesn't support them The ":" should not be used in element names because it is reserved to be used for something called namespaces Avoid to use “-” and “.”, these are normally used for specific purpose by software vendors book-title, book.title

22 Markup Element’s Attributes
XML elements can have attributes in the start tag <book isbn=“ ”> Attributes are used to provide additional information about elements Values are enclosed in quotes: either single or double Element car contains attribute doors, which has value “4” <car doors = “4”/>

23 Markup Element’s Attributes (cont.)
Use of Elements vs. Attributes Data can be stored in child elements or in attributes <person> <sex>female</sex> <firstname>Anna</firstname> <lastname>Smith</lastname> </person> <person sex = “female”> <firstname>Anna</firstname> <lastname>Smith</lastname> </person>

24 Markup Element’s Attributes (cont.)
Avoid using attributes? attributes cannot contain multiple values (child elements can) attributes are not easily expandable (for future changes) attributes cannot describe structures (child elements can) attributes are more difficult to manipulate by program code attribute values are not easy to test against a Document Type Definition (DTD) - which is used to define the legal elements of an XML document

25 Markup Element’s Attributes (cont.)
Processing instruction (PI) The <xsl:processing-instruction> element writes a processing instruction to the output PI: <xsl:processing-instruction name="xml-stylesheet"> href="style.css" type="text/css" </xsl:processing-instruction> Result: <?xml-stylesheet href="style.css" type="text/css"?> Passed to application using XML document Provides application-specific document information Delimited by <? and ?> Refers to Ch.12 eXtensible Stylsheet Language (XSL)

26 Processing instruction specifies stylesheet (discussed in Chapter 12)
1 <?xml version = "1.0"?> 2 3 <!-- Fig. 5.5 : usage.xml > 4 <!-- Usage of elements and attributes --> 5 6 <?xml:stylesheet type = "text/xsl" href = "usage.xsl"?> 7 8 <book isbn = " X"> 9 <title>Deitel&s XML Primer</title> 10 11 <author> <firstName>Paul</firstName> <lastName>Deitel</lastName> 14 </author> 15 16 <chapters> <preface num = "1" pages = "2">Welcome</preface> <chapter num = "1" pages = "4">Easy XML</chapter> <chapter num = "2" pages = "2">XML Elements?</chapter> <appendix num = "1" pages = "9">Entities</appendix> 21 </chapters> 22 23 <media type = "CD"/> 24 </book> Fig. 5.5 XML document that marks up information about a fictitious book. Processing instruction specifies stylesheet (discussed in Chapter 12) Root element book contains child elements title, author, chapters and media Element book contains attribute isbn, which has value of X Element chapters contains four child elements, each which contain two attributes Root element book contains child elements title, author, chapters and media Element book contains attribute isbn, which has value of X Element chapters contains four child elements, each which contain two attributes

27 Fig. 5.5 XML document that marks up information about a fictitious book.

28 Fig. 5.6 XML document that marks up a letter.
1 <?xml version = "1.0"?> 2 3 <!-- Fig. 5.6: letter.xml > 4 <!-- Business letter formatted with XML --> 5 6 <letter> 7 8 <contact type = "from"> <name>Jane Doe</name> <address1>Box 12345</address1> <address2>15 Any Ave.</address2> <city>Othertown</city> <state>Otherstate</state> <zip>67890</zip> <phone> </phone> <flag gender = "F"/> 17 </contact> 18 19 <contact type = "to"> <name>Jane Doe</name> <address1>123 Main St.</address1> <address2></address2> <city>Anytown</city> <state>Anystate</state> <zip>12345</zip> <phone> </phone> <flag gender = "M"/> 28 </contact> 29 Fig. 5.6 XML document that marks up a letter.

29 Fig. 5.6 XML document that marks up a letter. (Part 2)
30 <salutation>Dear Sir:</salutation> 31 32 <paragraph>It is our privilege to inform you about our new database managed with <bold>XML</bold>. This new system allows you to reduce the load on your inventory list server by having the client machine perform the work of sorting and filtering the data.</paragraph> 37 38 <paragraph>The data in an XML element is normalized, so plain-text diagrams such as /---\ | | \---/ will become gibberish.</paragraph> 44 45 <closing>Sincerely</closing> 46 <signature>Ms. Doe</signature> 47 48 </letter> Fig. 5.6 XML document that marks up a letter. (Part 2)

30 Fig. 5.6 XML document that marks up a letter.

31 XML Validation XML with correct syntax is Well Formed XML.
XML validated against a Document Type Definition (DTD is Valid XML) A DTD defines the legal elements of an XML document XML Schema is an XML based alternative to DTD Errors will Stop you XML Parsing Error

32 XML Validation (cont.) XML Browser Support
XML in Mozilla Firefox 1.0: supports the XML 1.0 standard XML in Netscape 6: Netscape 6 supports XML XML in Internet Explorer 5.0 : supports the XML 1.0 standard

33 XML Validation (cont.) IE 5.0 has the following XML support:
Viewing of XML documents Full support for W3C DTD standards XML embedded in HTML as Data Islands Binding XML data to HTML elements Transforming and displaying XML with XSL Displaying XML with CSS Access to the XML DOM

34 Parsers and Well-formed XML Documents
XML parser To read and update - create and manipulate - an XML document, you need an XML parser Processes XML document Reads XML document Checks syntax Reports errors (if any) Allows programmatic access to document’s contents Example (by Javascript) var xmlDoc=new ActiveXObject("Microsoft.XMLDOM") Create an XML document object XML Presentation

35 Parsers and Well-formed XML Documents (cont.)
XML document syntax Considered well formed if syntactically correct Single root element Each element has start tag and end tag Tags properly nested Attribute (discussed before) values in quotes Proper capitalization Case sensitive

36 Parsers and Well-formed XML Documents (cont.)
XML parsers support Document Object Model (DOM, heavy-weight API) Builds tree structure containing document data in memory Simple API for XML (SAX, light-weight API) Generates events when tags, comments, etc. are encountered (Events are notifications to the application) More like event-driven

37 Parsing an XML Document with msxml
Load XML document into Internet Explorer 5.0 Document is parsed by msxml.(from Microsoft) Places plus (+) or minus (-) signs next to container elements Plus sign indicates that all child elements are hidden Clicking plus sign expands container element Displays children Minus sign indicates that all child elements are visible Clicking minus sign collapses container element Hides children Error generated, if document is not well formed Examples

38 XML document shown in IE5.

39 Fig. 5.3 Error message for a missing end tag.

40 Characters Character set
Characters that may be represented in XML document e.g., ASCII character set Letters of English alphabet Digits (0-9) Punctuation characters, such as !, - and ?

41 White Space, Entity References and Built-in Entities
Whitespace characters Spaces, tabs, line feeds and carriage returns Significant (preserved by application) Insignificant (not preserved by application) Normalization Whitespace collapsed into single whitespace character Sometimes whitespace removed entirely <markup>This is character data</markup> after normalization, becomes <markup>This is character data</markup>

42 White Space, Entity References and Built-in Entities (cont.)
XML-reserved characters Ampersand (&) Left-angle bracket (<) Right-angle bracket (>) Apostrophe (’) Double quote (”) Entity references Allow to use XML-reserved characters Begin with ampersand (&) and end with semicolon (;) Prevents from misinterpreting character data as markup

43 White Space, Entity References and Built-in Entities (cont.)
Build-in entities Ampersand (&) Left-angle bracket (<) Right-angle bracket (>) Apostrophe (&apos;) Quotation mark (") Mark up characters “<>&” in element message <message><>&</message> < > & & &apos; ' " "

44 Character Set XML documents may contain
Carriage Return (CR + LF) returns Line feeds (LF) Unicode characters (Section 5.5.4) Enables computers to process characters for several languages Use editor that support the encoding More about unicode specification, please visit:

45 Using Unicode in an XML Document
XML Unicode support e.g., Fig. 5.4 displays Arabic words Arabic characters represented by entity references for Unicode characters

46 Document type definition (DTD) defines document structure and entities
1 <?xml version = "1.0"?> 2 3 <!-- Fig. 5.4 : lang.xml --> 4 <!-- Demonstrating Unicode --> 5 6 <!DOCTYPE welcome SYSTEM "lang.dtd"> 7 8 <welcome> 9 <from> 10 <!-- Deitel and Associates --> دايتَل أند 14 <!-- entity --> &assoc; 17 </from> 18 19 <subject> 20 <!-- Welcome to the world of Unicode --> أهلاً بكم فيِ عالم 26 <!-- entity --> &text; 29 </subject> 30 </welcome> Document type definition (DTD) defines document structure and entities Fig. 5.4 XML document that contains Arabic words Document type definition (DTD) defines document structure and entities Root element welcome contains child elements from and subject Sequence of entity references for Unicode characters in Arabic alphabet lang.dtd defines entities assoc and text Root element welcome contains child elements from and subject Sequence of entity references for Unicode characters in Arabic alphabet lang.dtd defines entities assoc and text

47 Fig. 5.4 XML document that contains Arabic words.
Show Example

48 Characters vs. Markup XML must differentiate between Markup text
Enclosed in angle brackets (< and >) e.g,. <message> Character data Text between start tag and end tag e.g., Fig. 5.1, line 7: Welcome to XML!

49 CDATA Sections Parsing or not Parsing (CDATA section)
CDATA sections: <![CDATA[…………………………. ]]> Everything inside a CDATA section is ignored by the parser May contain text, reserved characters and whitespace Reserved characters need not be replaced by entity references A CDATA section cannot contain the string "]]>", nested CDATA sections are not allowed Commonly used for scripting code (e.g., JavaScript)

50 Fig. 5.7 Using a CDATA section.
1 <?xml version = "1.0"?> 2 3 <!-- Fig. 5.7 : cdata.xml > 4 <!-- CDATA section containing C++ code --> 5 6 <book title = "C++ How to Program" edition = "3"> 7 8 <sample> // C++ comment if ( this->getX() < 5 && value[ 0 ] != 3 ) cerr << this->displayError(); 12 </sample> 13 14 <sample> <![CDATA[ 16 // C++ comment if ( this->getX() < 5 && value[ 0 ] != 3 ) cerr << this->displayError(); ]]> 21 </sample> 22 23 C++ How to Program by Deitel & Deitel 24 </book> Fig. 5.7 Using a CDATA section. Entity references required if not in CDATA section XML does not process CDATA section Note the simplicity offered by CDATA section Entity references required if not in CDATA section XML does not process CDATA section Note the simplicity offered by CDATA section

51 Fig. 5.7 Using a CDATA section

52 XML Namespaces XML Namespaces provide a method to avoid element name conflicts Naming collisions Two different elements have same name <subject>Math</subject> <subject>Thrombosis</subject> Solving Name Conflicts using a Prefix Namespaces Differentiate elements that have same name <school:subject>Math</school:subject> <medical:subject>Thrombosis</medical:subject> school and medical are namespace prefixes Prepended to elements and attribute names Tied to uniform resource identifier (URI) Series of characters for differentiating names

53 XML Namespaces (cont.) <h:table> <h:tr>
<h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr> </h:table> <f:table> <f:name>African Coffee Table</f:name> <f:width>80</f:width> <f:length>120</f:length> </f:table>

54 XML Namespaces (cont.) Uniform Resource Identifier (URI)
A string of characters which identifies an Internet Resource. The most common URI is the Uniform Resource Locator (URL) which identifies an Internet domain address Note that the address used to identify the namespace, is not used by the parser to look up information. The only purpose is to give the namespace a unique name to be identified

55 XML Namespaces (cont.) Creating namespaces: Use xmlns keyword
xmlns:text = “urn:deitel:textInfo” xmlns:image = “urn:deitel:imageInfo” Creates two namespace prefixes text and image urn:deitel:textInfo is URI for prefix text urn:deitel:imageInfo is URI for prefix image Default namespaces Child elements of this namespace do not need prefix xmlns = “urn:deitel:textInfo”

56 Element directory contains two namespace prefixes
1 <?xml version = "1.0"?> 2 3 <!-- Fig. 5.8 : namespace.xml --> 4 <!-- Namespaces > 5 6 <directory xmlns:text = "urn:deitel:textInfo" xmlns:image = "urn:deitel:imageInfo"> 8 9 <text:file filename = "book.xml"> <text:description>A book list</text:description> 11 </text:file> 12 13 <image:file filename = "funny.jpg"> <image:description>A funny picture</image:description> <image:size width = "200" height = "100"/> 16 </image:file> 17 18 </directory> Element directory contains two namespace prefixes Fig. 5.8 Listing for namespace.xml. Element directory contains two namespace prefixes Use prefix text to describe elements file and description Apply prefix image to describe elements file, description and size Use prefix text to describe elements file and description Apply prefix image to describe elements file, description and size

57 urn:deitel:textInfo is default namespace
1 <?xml version = "1.0"?> 2 3 <!-- Fig. 5.9 : defaultnamespace.xml --> 4 <!-- Using Default Namespaces > 5 6 <directory xmlns = "urn:deitel:textInfo" xmlns:image = "urn:deitel:imageInfo"> 8 9 <file filename = "book.xml"> <description>A book list</description> 11 </file> 12 13 <image:file filename = "funny.jpg"> <image:description>A funny picture</image:description> <image:size width = "200" height = "100"/> 16 </image:file> 17 18 </directory> Fig. 5.9 Using default namespaces. urn:deitel:text-Info is default namespace Element file is in default namespace Specify namespace Element file is in default namespace Specify namespace

58 An XML Application A small framework for an XML application
XML document Load the document into a Data Island Bind the Data Island to an HTML Table Bind the Data Island to <span> or <div> elements Add a Navigation Script to your XML

59 An XML Application (cont.)
With a little creativity you can create a full application. If you use what you have learned on this page, and a little imagination, you can easily develop this into a full application Now, let’s see what we can do with those techniques we just learned? Demo

60 HW # 1 P. 132 Exercises 5.4,5.5,5.6 Due day: Before next lecture (3/11) Submit your homework# 1 to TAs How to submit? Will be posted on the web page

61 That’s it for today, Have a nice weekend!

62 An XML Application: 1. XML document
First we start with a simple XML document. An original demonstration document, the CD catalog <?xml version="1.0" encoding="ISO "?> <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> . ... more ...

63 An XML Application Load the document into a Data Island
A Data Island can be used to access the XML file. To get your XML document "inside" an HTML page, add an XML Data Island to the page. The XML file "cd_catalog.xml" will be loaded into an "invisible" Data Island called "xmldso". The async="false" attribute is added to the Data Island to make sure that all the XML data is loaded before any other HTML processing takes place. <xml src="cd_catalog.xml" id="xmldso" async="false"> </xml>

64 An XML Application: Bind the Data Island to an HTML Table
An HTML table can be used to display the XML data. To make your XML data visible on your HTML page, you must "bind" your XML Data Island to an HTML element. To bind your XML data to an HTML table, add an attribute <table datasrc="#xmldso" ….> Add data field attributes: <span datafld="TITLE" >

65 An XML Application: Bind the Data Island to an HTML Table (cont.)
<table datasrc="#xmldso" width="100%" border="1"> <thead> <th>Title</th> <th>Artist</th> <th>Year</th> </thead> <tr align="left"> <td><span datafld="TITLE"></span></td> <td><span datafld="ARTIST"></span></td> <td><span datafld="YEAR"></span></td> </tr> </table> Show

66 An XML Application: Bind the Data Island to <span> or <div> elements
<span> or <div> elements can be used to display XML data. You don't have to use a table to display your XML data. Data from a Data Island can be displayed anywhere on an HTML page by adding some <span> or <div> elements to your page. Use the data source attribute to bind the elements to the Data Island, and the data field attribute to bind each element to an XML element, like this <span datasrc="#xmldso" datafld="TITLE"> <div datasrc="#xmldso" datafld="TITLE">

67 An XML Application: Bind the Data Island to <span> or <div> elements (cont.)
<br />Title: <span datasrc="#xmldso" datafld="TITLE"></span> <br />Artist: <span datasrc="#xmldso" datafld="ARTIST"></span> <br />Year: <span datasrc="#xmldso" datafld="YEAR"></span> <br />Title: <div datasrc="#xmldso" datafld="TITLE"></div> <br />Artist: <div datasrc="#xmldso" datafld="ARTIST"></div> <br />Year: <div datasrc="#xmldso" datafld="YEAR"></div> Show

68 An XML Application: Add a Navigation Script to your XML
Navigation has to be performed by a script. Add navigation to the XML Data Island, create a script that calls the movenext() and moveprevious() methods of the Data Island <script type="text/javascript"> function movenext(){ x=xmldso.recordset if (x.absoluteposition < x.recordcount){ x.movenext() } function moveprevious(){ if (x.absoluteposition > 1){ x.moveprevious() </script> Show

69 XML Related Technologies
XHTML - Extensible HTML XHTML is the re-formulation of HTML 4.01 in XML. XHTML 1.0 is the latest version of HTML CSS - Cascading Style Sheets CSS style sheets can be added to XML documents to provide display information XSL - Extensible Style Sheet Language XSL consists of three parts: XML Document Transformation (renamed XSLT, see below), a pattern matching syntax (renamed XPath, see below), and a formatting object interpretation

70 XML Related Technologies (cont.)
XSLT - XML Transformation XSLT is far more powerful than CSS. It can be used to transform XML files into many different output formats XPath - XML Pattern Matching XPath is a language for addressing parts of an XML document. XPath was designed to be used by both XSLT and XPointer XLink - XML Linking Language The XML Linking Language (XLink) allows elements to be inserted into XML documents in order to create links between XML resources

71 XML Related Technologies (cont.)
XPointer - XML Pointer Language The XML Pointer Language (XPointer) supports addressing into the internal structures of XML documents, such as elements, attributes, and content XQL - XML Query Language The XML Query Language supports query facilities to extract data from XML documents

72 XML Examples


Download ppt "eXtensible Markup Language (XML)"

Similar presentations


Ads by Google