Presentation is loading. Please wait.

Presentation is loading. Please wait.

Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.

Similar presentations


Presentation on theme: "Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language."— Presentation transcript:

1 Waqas Anwar Next SlidePrevious Slide

2 Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language

3 Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language XML is a markup language much like HTML

4 Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data

5 Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data XML tags are not predefined. You must define your own tags

6 Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data XML tags are not predefined. You must define your own tags XML uses a Document Type Definition (DTD) or an XML Schema to describe the data

7 Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data XML tags are not predefined. You must define your own tags XML uses a Document Type Definition (DTD) or an XML Schema to describe the data XML with a DTD or XML Schema is designed to be self- descriptive

8 Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data XML tags are not predefined. You must define your own tags XML uses a Document Type Definition (DTD) or an XML Schema to describe the data XML with a DTD or XML Schema is designed to be self- descriptive XML is a W3C Recommendation

9 Waqas Anwar Next SlidePrevious Slide XML XML does not DO anything

10 Waqas Anwar Next SlidePrevious Slide XML XML does not DO anything XML is free and extensible

11 Waqas Anwar Next SlidePrevious Slide XML XML does not DO anything XML is free and extensible XML is a complement to HTML

12 Waqas Anwar Next SlidePrevious Slide XML XML does not DO anything XML is free and extensible XML is a complement to HTML XML is future Web development

13 Waqas Anwar Next SlidePrevious Slide XML XML does not DO anything XML is free and extensible XML is a complement to HTML XML is future Web development XML is going to be everywhere.

14 Waqas Anwar Next SlidePrevious Slide XML vs. HTML HTML is about displaying information XML is about describing information. HTML was designed to display data and to focus on how data looks. XML was designed to describe data and to focus on what data is.

15 Waqas Anwar Next SlidePrevious Slide How can XML be Used XML can Separate Data from HTML

16 Waqas Anwar Next SlidePrevious Slide How can XML be Used XML can Separate Data from HTML XML is used to Exchange Data

17 Waqas Anwar Next SlidePrevious Slide How can XML be Used XML can Separate Data from HTML XML is used to Exchange Data XML can be used to Share Data

18 Waqas Anwar Next SlidePrevious Slide How can XML be Used XML can Separate Data from HTML XML is used to Exchange Data XML can be used to Share Data XML can be used to Store Data

19 Waqas Anwar Next SlidePrevious Slide How can XML be Used XML can Separate Data from HTML XML is used to Exchange Data XML can be used to Share Data XML can be used to Store Data XML can make your Data more Useful

20 Waqas Anwar Next SlidePrevious Slide How can XML be Used XML can Separate Data from HTML XML is used to Exchange Data XML can be used to Share Data XML can be used to Store Data XML can make your Data more Useful XML can be used to Create new Languages

21 Waqas Anwar Next SlidePrevious Slide XML Components Comment Declaration Root Element Element Nested Element (child element) Template Data Empty Element Attribute

22 Waqas Anwar Next SlidePrevious Slide Comment …

23 Waqas Anwar Next SlidePrevious Slide Declaration encoding=" UTF-7” encoding=" UTF-8”

24 Waqas Anwar Next SlidePrevious Slide Root Element

25 Waqas Anwar Next SlidePrevious Slide Nested Elements

26 Waqas Anwar Next SlidePrevious Slide Template Data Waqas Nadeem Meeting Reminder Don’t forget me this weekend

27 Waqas Anwar Next SlidePrevious Slide Empty Element Waqas Nadeem Meeting Reminder Don't forget me this weekend! or both are valid

28 Waqas Anwar Next SlidePrevious Slide Attribute Waqas Nadeem Meeting Reminder Don't forget me this weekend!

29 Waqas Anwar Next SlidePrevious Slide All XML Components Waqas Nadeem Meeting Reminder Don't forget me this weekend!

30 Waqas Anwar Next SlidePrevious Slide Well Formed XML Documents

31 Waqas Anwar Next SlidePrevious Slide All XML elements must have a closing tag. Well-Formed Document Rules

32 Waqas Anwar Next SlidePrevious Slide All XML elements must have a closing tag XML tags are case sensitive Well-Formed Document Rules

33 Waqas Anwar Next SlidePrevious Slide All XML elements must have a closing tag XML tags are case sensitive All XML elements must be properly nested Well-Formed Document Rules

34 Waqas Anwar Next SlidePrevious Slide All XML elements must have a closing tag XML tags are case sensitive All XML elements must be properly nested All XML documents must have a root element Well-Formed Document Rules

35 Waqas Anwar Next SlidePrevious Slide Well-Formed Document Rules All XML elements must have a closing tag XML tags are case sensitive All XML elements must be properly nested All XML documents must have a root element Attribute values must always be quoted

36 Waqas Anwar Next SlidePrevious Slide All XML elements must have a closing tag XML tags are case sensitive All XML elements must be properly nested All XML documents must have a root element Attribute values must always be quoted Attributes can not be duplicated in one element. Well-Formed Document Rules

37 Waqas Anwar Next SlidePrevious Slide Exercise Create a well-formed XML document describing the mobile phone specification which is send by one mobile phone manufacture to different phone dealers. You need to describe the following information with every mobile. mobile-code brand-name model color price

38 Waqas Anwar Next SlidePrevious Slide Solution 11-258-745 Nokia 6630 silver 299.99 11-365-125 Samsung D500 black 499.99

39 Waqas Anwar Next SlidePrevious Slide XML Transformation

40 Waqas Anwar Next SlidePrevious Slide XML Transformation XML does not use predefined tags and the meaning of these tags are not well understood.

41 Waqas Anwar Next SlidePrevious Slide XML Transformation XML does not use predefined tags and the meaning of these tags are not well understood. A element could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it.

42 Waqas Anwar Next SlidePrevious Slide XML Transformation XML does not use predefined tags and the meaning of these tags are not well understood. A element could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it. We can transform XML files into other formats like HTML, Text, XML, DOC, PDF

43 Waqas Anwar Next SlidePrevious Slide XML Transformation XML does not use predefined tags and the meaning of these tags are not well understood. A element could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it. We can transform XML files into other formats like HTML, Text, XML, DOC, PDF We use following technologies for transformation CSS XSL / XSLT XSLT-FO

44 Waqas Anwar Next SlidePrevious Slide CSS Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation of a document written in a markup languages. Its most common application is to style web pages written in HTML, XHTML or XML

45 Waqas Anwar Next SlidePrevious Slide CSS Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation of a document written in a markup languages. Its most common application is to style web pages written in HTML, XHTML or XML CSS define how to display HTML elements

46 Waqas Anwar Next SlidePrevious Slide CSS Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation of a document written in a markup languages. Its most common application is to style web pages written in HTML, XHTML or XML CSS define how to display HTML elements Styles are normally stored in Style Sheets

47 Waqas Anwar Next SlidePrevious Slide CSS Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation of a document written in a markup languages. Its most common application is to style web pages written in HTML, XHTML or XML CSS define how to display HTML elements Styles are normally stored in Style Sheets Styles were added to HTML 4.0

48 Waqas Anwar Next SlidePrevious Slide CSS Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation of a document written in a markup languages. Its most common application is to style web pages written in HTML, XHTML or XML CSS define how to display HTML elements Styles are normally stored in Style Sheets Styles were added to HTML 4.0 External Style Sheets are stored in CSS files

49 Waqas Anwar Next SlidePrevious Slide CSS Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation of a document written in a markup languages. Its most common application is to style web pages written in HTML, XHTML or XML CSS define how to display HTML elements Styles are normally stored in Style Sheets Styles were added to HTML 4.0 External Style Sheets are stored in CSS files External Style Sheets can save you a lot of work

50 Waqas Anwar Next SlidePrevious Slide catalog.xml Titanic Pakistan Columbia Pictures 100 2000 Jurassic Park United Kingdom Paramount Pictures 100 2002

51 Waqas Anwar Next SlidePrevious Slide style.css catalog { background-color: #336699; width: 50%; font-size:12ptt; font-family:Arial; border-size:1; border-style:solid; border-color:#336699; }

52 Waqas Anwar Next SlidePrevious Slide style.css catalog { background-color: #336699; width: 50%; font-size:12ptt; font-family:Arial; border-size:1; border-style:solid; border-color:#336699; } cd { display: block; background-color: #ffffff; }

53 Waqas Anwar Next SlidePrevious Slide style.css catalog { background-color: #336699; width: 50%; font-size:12ptt; font-family:Arial; border-size:1; border-style:solid; border-color:#336699; } cd { display: block; background-color: #ffffff; } title { width:100%; background-color: #336699; color:white; padding: 5px; }

54 Waqas Anwar Next SlidePrevious Slide style.css catalog { background-color: #336699; width: 50%; font-size:12ptt; font-family:Arial; border-size:1; border-style:solid; border-color:#336699; } cd { display: block; background-color: #ffffff; } title { width:100%; background-color: #336699; color:white; padding: 5px; } country,price,year,company { background-color: #ffffff; display: block; font-size:10pt; font-family:Arial; color: #000000; margin-left: 5pt; }

55 Waqas Anwar Next SlidePrevious Slide Link CSS with XML Titanic Pakistan Columbia Pictures 100 2000 Jurassic Park United Kingdom Paramount Pictures 100 2002

56 Waqas Anwar Next SlidePrevious Slide XSL XSL consists of three parts XSLT - a language for transforming XML documents XPath - a language for navigating in XML documents XSL-FO - a language for formatting XML documents

57 Waqas Anwar Next SlidePrevious Slide XSLT Transformation XSLT stands for XSL Transformations XSLT is the most important part of XSL XSLT transforms an XML document into another document XSLT uses XPath to navigate in XML documents XSLT is a W3C Recommendation

58 Waqas Anwar Next SlidePrevious Slide XML with XSLT Titanic Pakistan Columbia Pictures 100 2000 Jurassic Park United Kingdom Paramount Pictures 100 2002

59 Waqas Anwar Next SlidePrevious Slide Link XML with XSLT We link the external style sheet with XML using the following line.

60 Waqas Anwar Next SlidePrevious Slide XSLT Declaration The correct way to declare an XSL style sheet according to the W3C XSLT Recommendation is: or

61 Waqas Anwar Next SlidePrevious Slide XSLT Templates An XSL style sheet consists of one or more set of rules that are called templates. The element is used to build templates. The match attribute is used to associate a template with an XML element. The match attribute can also be used to define a template for the entire XML document. The value of the match attribute is an XPath expression.

62 Waqas Anwar Next SlidePrevious Slide The element can be used to extract the value of an XML element and add it to the output stream of the transformation. The value of the select attribute is an XPath expression. An XPath expression works like navigating a file system.

63 Waqas Anwar Next SlidePrevious Slide The element allows you to do looping in XSLT. The XSL element can be used to select every XML element of a specified node-set:

64 Waqas Anwar Next SlidePrevious Slide The element is used to sort the output. To sort the output, simply add an element inside the element in the XSL file

65 Waqas Anwar Next SlidePrevious Slide Complete XSLT File DVD Title Country Company Price Year

66 Waqas Anwar Next SlidePrevious Slide XML Validation

67 Waqas Anwar Next SlidePrevious Slide XML Validation We can use following two technologies two validate XML files. DTD Schema

68 Waqas Anwar Next SlidePrevious Slide Document Type Definition The purpose of a DTD (Document Type Definition) is to define the legal building blocks of an XML document.

69 Waqas Anwar Next SlidePrevious Slide Document Type Definition The purpose of a DTD (Document Type Definition) is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements.

70 Waqas Anwar Next SlidePrevious Slide Document Type Definition The purpose of a DTD (Document Type Definition) is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements. A DTD can be declared inline in your XML document, or as an external reference.

71 Waqas Anwar Next SlidePrevious Slide Benefits of DTD With DTD, each of your XML files can carry a description of its own format with it.

72 Waqas Anwar Next SlidePrevious Slide Benefits of DTD With DTD, each of your XML files can carry a description of its own format with it. With a DTD, independent groups of people can agree to use a common DTD for interchanging data.

73 Waqas Anwar Next SlidePrevious Slide Benefits of DTD With DTD, each of your XML files can carry a description of its own format with it. With a DTD, independent groups of people can agree to use a common DTD for interchanging data. Your application can use a standard DTD to verify that the data you receive from the outside world is valid.

74 Waqas Anwar Next SlidePrevious Slide Benefits of DTD With DTD, each of your XML files can carry a description of its own format with it. With a DTD, independent groups of people can agree to use a common DTD for interchanging data. Your application can use a standard DTD to verify that the data you receive from the outside world is valid. You can also use a DTD to verify your own data. DTD is old technology and replaced more powerful and latest technology XML Schema.

75 Waqas Anwar Next SlidePrevious Slide XML Schema An XML Schema: 1. defines elements that can appear in a document

76 Waqas Anwar Next SlidePrevious Slide XML Schema An XML Schema: 1. defines elements that can appear in a document 2. defines attributes that can appear in a document

77 Waqas Anwar Next SlidePrevious Slide XML Schema An XML Schema: 1. defines elements that can appear in a document 2. defines attributes that can appear in a document 3. defines which elements are child elements

78 Waqas Anwar Next SlidePrevious Slide XML Schema An XML Schema: 1. defines elements that can appear in a document 2. defines attributes that can appear in a document 3. defines which elements are child elements 4. defines the order of child elements

79 Waqas Anwar Next SlidePrevious Slide XML Schema An XML Schema: 1. defines elements that can appear in a document 2. defines attributes that can appear in a document 3. defines which elements are child elements 4. defines the order of child elements 5. defines the number of child elements

80 Waqas Anwar Next SlidePrevious Slide XML Schema An XML Schema: 1. defines elements that can appear in a document 2. defines attributes that can appear in a document 3. defines which elements are child elements 4. defines the order of child elements 5. defines the number of child elements 6. defines whether an element is empty or can include text

81 Waqas Anwar Next SlidePrevious Slide XML Schema An XML Schema: 1. defines elements that can appear in a document 2. defines attributes that can appear in a document 3. defines which elements are child elements 4. defines the order of child elements 5. defines the number of child elements 6. defines whether an element is empty or can include text 7. defines data types for elements and attributes

82 Waqas Anwar Next SlidePrevious Slide XML Schema An XML Schema: 1. defines elements that can appear in a document 2. defines attributes that can appear in a document 3. defines which elements are child elements 4. defines the order of child elements 5. defines the number of child elements 6. defines whether an element is empty or can include text 7. defines data types for elements and attributes 8. defines default and fixed values for elements and attributes

83 Waqas Anwar Next SlidePrevious Slide XML Validation with XML Schema Waqas Nadeem Meeting Reminder Don't forget me this weekend!

84 Waqas Anwar Next SlidePrevious Slide XML Validation with XML Schema Waqas Nadeem Meeting Reminder Don't forget me this weekend!

85 Waqas Anwar Next SlidePrevious Slide Root Element

86 Waqas Anwar Next SlidePrevious Slide Simple Element A simple element is an element that only contains template date. Waqas 120000

87 Waqas Anwar Next SlidePrevious Slide Complex Element A complex element is an XML element that contains other elements and/or attributes. There are four kinds of complex elements: empty elements elements that contain only other elements elements that contain only text elements that contain both other elements and text Note: Each of these elements may contain attributes as well!

88 Waqas Anwar Next SlidePrevious Slide Complex Element John Smith Ice cream It happened on 03.03.99....

89 Waqas Anwar Next SlidePrevious Slide Declare Simple Element A simple element is an XML element that can contain only text. It cannot contain any other elements or attributes.

90 Waqas Anwar Next SlidePrevious Slide Declare Simple Element Ali 34 1978-03-27

91 Waqas Anwar Next SlidePrevious Slide Declare Simple Element Ali 34 1978-03-27

92 Waqas Anwar Next SlidePrevious Slide Declare Simple Element Ali 34 1978-03-27

93 Waqas Anwar Next SlidePrevious Slide Declare Simple Element Ali 34 1978-03-27

94 Waqas Anwar Next SlidePrevious Slide Common Schema Data types xs:string xs:decimal xs:integer xs:boolean xs:date xs:time

95 Waqas Anwar Next SlidePrevious Slide Declare default and fixed value for simple elements

96 Waqas Anwar Next SlidePrevious Slide Declare Attributes

97 Waqas Anwar Next SlidePrevious Slide Declare Attributes Waqas

98 Waqas Anwar Next SlidePrevious Slide Declare Attributes Waqas

99 Waqas Anwar Next SlidePrevious Slide Declare default and fixed value for attributes

100 Waqas Anwar Next SlidePrevious Slide Declare optional and required attributes

101 Waqas Anwar Next SlidePrevious Slide XSD Restrictions Restrictions are used to control acceptable values for XML elements or attributes. Restriction on Values

102 Waqas Anwar Next SlidePrevious Slide Restriction on Set of Values

103 Waqas Anwar Next SlidePrevious Slide Restriction on Series of Values

104 Waqas Anwar Next SlidePrevious Slide Restriction on Series of Values

105 Waqas Anwar Next SlidePrevious Slide Restriction on Series of Values

106 Waqas Anwar Next SlidePrevious Slide Restriction on length


Download ppt "Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language."

Similar presentations


Ads by Google