Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML EXtensible Markup Language. Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA.

Similar presentations


Presentation on theme: "XML EXtensible Markup Language. Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA."— Presentation transcript:

1 XML EXtensible Markup Language

2 Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA XML Q&A XML Quiz

3 Introduction to XML What is XML?  XML stands for EXtensible Markup Language  XML was designed to describe data  XML tags are not predefined. You can define your own tags  XML uses a Document Type Definition (DTD) or an XML Schema to describe the data  XML is a W3C (World Wide Web Consortium) Recommendation

4 Introduction to XML What is the main difference between XML and HTML?  XML was designed to describe data and to focus on what data is.  HTML was designed to display data and to focus on how data looks.  HTML is about displaying information, while XML is about describing information.

5 Introduction to XML Why XML is free and extensible?  XML was created to structure, store and to send information.  XML tags are not predefined. You can "invent" your own tags.  The author of HTML documents can only use tags that are defined in the HTML standard (like,, etc.).  But the author of XML documents can define his own tags and his own document structure. Note : XML is not a replacement for HTML.

6 Introduction to XML Sample XML document Tove Jani Reminder Don't forget me this weekend!

7 Introduction to XML XML is going to be everywhere. What are the other technologies which are related to the XML?  XSLT - EXtensible Stylesheet Language Transformations  XSL-FO - EXtensible Stylesheet Language Formatting Objects  XPath  XQuery  XLink  XML Schema  Many more…

8 XML Rules What are the XML rules?  All XML Elements Must Have a Closing Tag  XML Tags are Case Sensitive  XML Elements Must be Properly Nested  XML Documents Must Have a Root Element  XML Attribute Values Must be Quoted  With XML, White Space is Preserved  Comments in XML

9 XML Rules All XML Elements Must Have a Closing Tag Do not have a closing tag - Incorrect This is a paragraph This is another paragraph Correct This is a paragraph This is another paragraph XML Tags are Case Sensitive Incorrect This is incorrect Correct This is correct

10 XML Rules XML Elements Must be Properly Nested Incorrect This text is bold and italic Correct This text is bold and italic XML Documents Must Have a Root Element Correct.....

11 XML Rules XML Attribute Values Must be Quoted Incorrect Tove Jani Correct Tove Jani

12 XML Rules With XML, White Space is Preserved  With XML, the white space in your document is not truncated. Comments in XML  The syntax for writing comments in XML is similar to that of HTML. 

13 XML Elements XML Elements are Extensible  XML documents can be extended to carry more information.  XML documents are Extensible. XML Elements have Relationships  Elements are related as parents and children. My First XML Introduction to XML Wat is HTML What is XML

14 XML Elements Elements have Content  Elements can have different content types.  An element can have, element content mixed content simple content or empty content Attributes Element Naming  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, etc)  Names cannot contain spaces

15 XML Attributes Attributes are used to provide additional information about elements. Attribute values must always be enclosed in quotes, but either single or double quotes can be used. or or

16 XML Validation XML with correct syntax is Well Formed XML.  XML documents must have a root element  XML elements must have a closing tag  XML tags are case sensitive  XML elements must be properly nested  XML attribute values must always be quoted XML validated against a DTD or a XML schema is Valid XML.  A "Valid" XML document is a "Well Formed" XML document,

17 XML Exercises BIT Subjects Year 1Year 2Year 3 Information Systems & Technology Object Oriented Systems Development Professional Issues in IT Computer Systems IMathematics for Computing-IISecurity of Information Systems Application PackagesOperational ResearchFinal Year Project Internet & World Wide WebBusiness ManagementIntelligent Systems Mathematics for Computing I Web Development TechniquesInternet Application Development Programming IData Communications & Networks Image Processing & Computer Vision Database Systems ISoftware Project ManagementSystems & Network Administration Systems Analysis & DesignRapid Application DevelopmentAdvanced Database Management Systems  Convert above table into XML document.

18 XML Exercises Check the Well-Formedness of following elements  The first list An item  An item Another item  Bathing a cat is a relatively easy task as long as the cat is willing.  How to Bathe a Cat Merlin Bauer

19 XML Exercises Create a well-formed XML document using following elements This procedure tells you how to bathe a cat. Cats don't like to take baths. You could get hurt doing this. Be sure to obtain all the required protective gear before you start. Hockey Mask Padded Full-body Kevlar Armor Tub full of warm water Towels First Aid kit Cat Shampoo Locate the cat, who by now is hiding under the bed. Place the cat in the tub of water. Using the First Aid kit, repair the damage to your head and arms. Place the cat back in the tub and hold it down. Wash it really fast, then make an effort to dry it with the towels. Decide not to do this again.

20 XML Namespaces XML Namespaces provide a method to avoid element name conflicts. Name Conflicts <!-- This table element carries information in a table  Apples Bananas <!-- This table element carries information about a table  African Coffee Table 80 120

21 XML Namespaces XML Namespaces provide a method to avoid element name conflicts. Name Conflicts <!-- This table element carries information in a table  Apples Bananas <!-- This table element carries information about a table  African Coffee Table 80 120

22 XML Namespaces Solving Name Conflicts Using a Prefix No name conflict, use a different name for their element ( and ). <!-- This table element carries information in a table  Apples Bananas <!-- This table element carries information about a table  African Coffee Table 80 120

23 XML Namespaces Using Namespaces Instead of using only prefixes, we have added an xmlns attribute to the tag to give the prefix a qualified name associated with a namespace. <!-- This table element carries information in a table  Apples Bananas <!-- This table element carries information about a table  African Coffee Table 80 120

24 XML Namespaces The XML namespace attribute is placed in the start tag of an element The only purpose is to give the namespace a unique name. xmlns:namespace-prefix="namespaceURI"

25 XML CDATA All text in an XML document will be parsed by the parser. Only text inside a CDATA section will be ignored by the parser. if salary <!– Working properly  if salary < 1000 then Illegal XML characters have to be replaced by entity references. There are 5 predefined entity references in XML

26 XML CDATA Note: Only the characters "<" and "&" are strictly illegal in XML. Apostrophes, quotation marks and greater than signs are legal, but it is a good habit to replace them. <<less than >>greater than &&ampersand &apos;'apostrophe ""quotation mark

27 XML CDATA CDATA  Everything inside a CDATA section is ignored by the parser. <![CDATA[ function matchwo(a,b) { if (a < b && a < 0) then { return 1 } else { return 0 } ]]>

28 XML Q&A

29 XML Quiz 1. What does XML stand for? X-Markup Language eXtensible Markup Language Example Markup Language eXtra Modern Link 2. There is a way of describing XML data, how? XML uses a DTD to describe the data XML uses XSL to describe data XML uses a description node to describe data 3. XML's goal is to replace HTML True False 4. What is the correct syntax of the declaration which defines the XML version?

30 XML Quiz 5. What does DTD stand for? Document Type Definition Direct Type Definition Do The Dance Dynamic Type Definition 6. Is this a "well formed" XML document? Tove Jani Reminder Don't forget me this weekend! No Yes

31 XML Quiz 7. Which statement is true? All XML documents must have a DTD All XML elements must be lower case All the statements are true All XML elements must be properly closed 8. Is this a "well formed" XML document? Tove Jani Reminder Don't forget me this weekend! Yes No 9. Which statement is true? XML documents must have a root tag XML elements must be properly nested XML tags are case sensitive All the statements are true

32 XML Quiz 10. XML preserves white spaces False True 11. Is this a "well formed" XML document? Tove Jani No Yes 12.XML elements cannot be empty False True

33 XML Quiz 13. Is this a "well formed" XML document? Tove Jani No Yes 14. Which is not a correct name for an XML element? All 3 names are incorrect

34 XML Quiz 15. Which is not a correct name for an XML element? All 3 names are incorrect 16. Which is not a correct name for an XML element? All 3 names are incorrect 17. XML attribute values must always be enclosed in quotes True False

35 XML Quiz 18. What does XSL stand for? eXtensible Style Listing eXtensible Stylesheet Language eXtra Style Language eXpandable Style Language 19. For the XML parser to ignore a certain section of your XML document, which syntax is correct? Text to be ignored Text to be ignored 20.Which is not a correct name for an XML element?


Download ppt "XML EXtensible Markup Language. Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA."

Similar presentations


Ads by Google