1 / 13

INF201 Fall2010 Intro. to Info. Technologies

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. What is XML. XML stands for EXtensible Markup Language

eilis
Télécharger la présentation

INF201 Fall2010 Intro. to Info. Technologies

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INF201 Fall2010Intro. 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. WhatisXML • 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. WhyXML? • XML iscomputerunderstandable,andcomputerusable • XML provideastandardway,avoidingerrors • 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. Forreference: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. XMLexample <?xml version="1.0"?> <note>     <to>Tove</to>     <from>Jani</from>     <heading>Reminder</heading>     <body>Don't forget me this weekend!</body> </note>

  7. XMLSyntax • XML declaration<?xml version="1.0"?> • Root element (Required)<note> • Child element(<to>,<from>,<heading>,<body>) • All XML Elements Must Have a Closing Tag • XML Tags are Case Sensitive<Letter> is different from the tag <letter> • XML Elements Must be Properly Nested<to><title>This is incorrect</to></title>notright • XML Attribute Values Must be Quoted <note date="09/29/2009">

  8. XMLdocumentstructure <root>  <child>    <subchild>.....</subchild>  </child></root>

  9. XML NamingRules • 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.<file type="gif">computer.gif</file> • 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 SchemaXML‐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 eXtensibleStylesheet Language Transformations To transform XML to HTML

  13. Howtocreatexmlfile? • Eitherusenotepadordreamweaver • DonotforgetputXML declaration<?xml version="1.0"?> • Saveasfilename.xml

More Related