Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 275—Web App Dev I XML. 2 Introduction to XMLXML XML stands for ________________________. HTML was designed to display data. XML was designed to _________.

Similar presentations


Presentation on theme: "CIS 275—Web App Dev I XML. 2 Introduction to XMLXML XML stands for ________________________. HTML was designed to display data. XML was designed to _________."— Presentation transcript:

1 CIS 275—Web App Dev I XML

2 2 Introduction to XMLXML XML stands for ________________________. HTML was designed to display data. XML was designed to _________ data. With XML, you define your own _______. Sample XML document: Tove Jani Reminder Don't forget me this weekend!

3 3 How can XML be Used? With XML, data can be stored separately from the ______ code. With XML, data are stored in plain _____ format. With XML, data can be exchanged between ____________ systems. Important languages like _____ are written in XML. XML is important for _____ applications.

4 4 XML Document Structure Sample XML document: Tove Jani Reminder Don't forget me this weekend! The XML document above consists of an XML ___________ One ______ element Four _______ elements

5 5 XML Syntax All XML elements must have a _________ tag. XML tags are ______ sensitive. XML elements must be properly nested. This text is bold and italic All XML documents must have a ______ element. Attribute values must be _________. Comments in XML look like this:

6 6 XML Elements XML documents are _________. New elements can be added without crashing an existing application. XML elements have ____________ (there are parent, child, and sibling elements). Elements have content Some have only element content (e.g., the root element) Some have simple (_____) content My First XML Some have mixed content (element and simple) Some have no content Elements may have ___________

7 7 Element Content My First XML Introduction to XML What is HTML What is XML XML Syntax Elements must have a closing tag Elements must be properly nested In this example, has _________ content, because it contains other elements. has _______ content because it contains both text and other elements. has ________ content (or text content) because it contains only text. has _______ content, because it carries no information.

8 8 XML Attributes Element attributes are not part of the data, but contain information about the data. computer.gif You should try to avoid using attributes, especially if the information feels like basic data. One good use of attributes is for _____________. Tove Jani Reminder Don't forget me this weekend! …

9 9 XML Validation A “well formed” XML document has correct _______. A “valid” XML document is both well formed and conforms to a DTD (__________ Type Definition). A DTD defines document structure and legal ______. An XML _________ is the W3C alternative to DTD. Invalid XML documents will not execute properly. See http://www.w3.org/XML/Schema.html for details. http://www.w3.org/XML/Schema.html XML validators: http://www.w3schools.com/dom/dom_validate.asp

10 10 Internal DOCTYPE Declaration <!DOCTYPE note [ ]> Tove Jani Reminder Don't forget me this weekend #PCDATA means “_______ character data.”

11 11 External DOCTYPE Declaration XML (note.xml) Tove Jani Reminder Don't forget me this weekend DTD (note.dtd)

12 12 Why use a DTD? With DTD, your XML files can carry a description of its own _________ with it. With a DTD, independent groups of people can agree to use a common DTD for ___________ data. Your application can use a _________ DTD to verify that the data you receive from the outside world is valid. You can also use a DTD to _______ your own data.

13 13 Viewing XML Files An XML document can be viewed in IE 5.0+ by typing the URL or double-clicking the icon. Look at this XML file: note.xml.note.xml Invalid XML files will not display: note_error.xml.note_error.xml Other Examples An XML CD catalog An XML plant catalog A Simple Food Menu

14 14 Displaying XML with CSS You can view an XML with the help of a CSS, but this is not the future of XML. Take a look at this pure XML file: The CD CatalogThe CD Catalog Then look at this style sheet: The CSS fileThe CSS file Finally, view the CD Catalog formatted with the CSS filethe CD Catalog formatted with the CSS file You can write a web page using XML, but this is not recommended: A homepage written in XML.A homepage written in XML ______ (HTML defined as XML) is recommended for creating web pages.

15 15 Displaying XML with XSL XSL (__________ Style Language) is the preferred style sheet language of XML. XSL is far more sophisticated than CSS. If you have Netscape 6 or IE 5 or higher you can view the XML file and the XSL style sheet.the XML filethe XSL style sheet View the result in IE 6 View the result in IE 5

16 16 XML Embedded in HTML The unofficial ______ tag is used to embed XML data within HTML. Tove Jani Reminder Don't forget me this weekend! You can embed a separate XML file.

17 17 Data Binding Example of binding a data island to an HTML element (in the following case, _______): Here is the result.result Here is the external XML file.external XML file


Download ppt "CIS 275—Web App Dev I XML. 2 Introduction to XMLXML XML stands for ________________________. HTML was designed to display data. XML was designed to _________."

Similar presentations


Ads by Google