Download presentation
Presentation is loading. Please wait.
1
INF201 Fall2010 Intro. to Info. Technologies Department of Informatics University at Albany – SUNY Original Source: w3schools.com Prepared by Xiao Liang, fall 2010 Adapted from Choi, Spring2009
2
What is XML XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry data, not to display data XML tags are not predefined. You must define your own tags XML is designed to be self‐descriptive XML is a W3C Recommendation
3
XML vs. HTML XML was designed to transport and store data. You design your own tags HTML was designed to display data. Tags are predefined. XML does not DO anything. XML was created to structure, store, and transport information.
4
Why XML? XML is computer understandable, and computer usable XML provide a standard way, avoiding errors XML provides a robust and durable format for information storage and transmission. Robust because it is based on a proven standard, and can thus be tested and verified; durable (persistent) because it uses plain-text file formats which will outlast proprietary binary ones. XML provides a common syntax for messaging systems for the exchange of information between applications XML is free. Not just free of charge (free as in beer) but free of legal encumbrances (free as in speech). XML information can be manipulated programmatically (under machine control), so XML documents can be pieced together from disparate sources, or taken apart and re-used in different ways. They can be converted into any other format with no loss of information. XML lets you separate form (appearance) from content. For reference: http://xml.silmaril.ie/basics/whyxml/http://xml.silmaril.ie/basics/whyxml/
5
How Can XML be Used? XML Separates Data from HTML XML Simplifies Data Sharing and Data Transport – XML data is stored in plain text format. This provides a software‐and hardware‐independent way of storing data. – Platform independent A lot of new Internet languages are created with XML
6
XML example Tove Jani Reminder Don't forget me this weekend!
7
XML Syntax XML declaration Root element (Required) Child element(,,, ) All XML Elements Must Have a Closing Tag – XML Tags are Case Sensitive is different from the tag – XML Elements Must be Properly Nested This is incorrect not right – XML Attribute Values Must be Quoted
8
XML document structure.....
9
XML Naming Rules – Names can contain letters, numbers, and other characters – Names cannot start with a number or punctuation character – Names cannot start with the letters xml (or XML, or Xml, etc) Names cannot contain spaces
10
XML Attributes Attributes often provide information that is not a part of the data. computer.gif It is NOT recommended to use attributesattributes cannot contain multiple values (elements can) attributes cannot contain tree structures (elements can) attributes are not easily expandable (for future changes)
11
XML Validation XML with correct syntax is "Well Formed" XML. XML validated against a DTDis "Valid" XML. – XML Schema XML‐based alternative to DTD W3schools.com XML Validator
12
XML Style DisplayingXML with CSS HTML is designed for content being sent to a browser. XML can be converted to HTML and read by browsers Displaying XML with XSLT eXtensible Stylesheet Language Transformations To transform XML to HTML
13
How to create xml file? Either use notepad or dreamweaver Do not forget put XML declaration Save as filename.xml
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.