1.07k likes | 1.27k Views
XML. XML. XML stands for E X tensible M arkup L anguage. XML. XML stands for E X tensible M arkup L anguage XML is a markup language much like HTML. XML. XML stands for E X tensible M arkup L anguage XML is a markup language much like HTML XML was designed to describe data.
E N D
XML • XML stands for EXtensible Markup Language
XML • XML stands for EXtensible Markup Language • XML is a markup language much like HTML
XML • XML stands for EXtensible Markup Language • XML is a markup language much like HTML • XML was designed to describe data
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 • 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 • 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 • 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
XML • XML does not DO anything
XML • XML does not DO anything • XML is free and extensible
XML • XML does not DO anything • XML is free and extensible • XML is a complement to HTML
XML • XML does not DO anything • XML is free and extensible • XML is a complement to HTML • XML is future Web development
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.
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.
How can XML be Used XML can Separate Data from HTML
How can XML be Used XML can Separate Data from HTML XML is used to Exchange Data
How can XML be Used XML can Separate Data from HTML XML is used to Exchange Data XML can be used to Share Data
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
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
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
XML Components Comment Declaration Root Element Element Nested Element (child element) Template Data Empty Element Attribute
Comment <!-- Email XML Document --> … … … …
Declaration <?xml version="1.0" encoding="ISO-8859-1"?> encoding=" UTF-7” encoding=" UTF-8”
Root Element <?xml version="1.0" encoding="ISO-8859-1"?> <note> </note>
Nested Elements <?xml version="1.0" encoding="ISO-8859-1"?> <note> <to></to> <from></from> <heading></heading> <body></body> </note>
Template Data <?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>Waqas</to> <from>Nadeem</from> <heading>Meeting Reminder</heading> <body>Don’t forget me this weekend</body> </note>
Empty Element <?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>Waqas</to> <from>Nadeem</from> <heading>Meeting Reminder</heading> <body>Don't forget me this weekend!</body> <send /> </note> <send /> or <send></send> both are valid
Attribute <?xml version="1.0" encoding="ISO-8859-1"?> <note id=“1101”date=“20-12-2006”> <to>Waqas</to> <from>Nadeem</from> <heading>Meeting Reminder</heading> <body>Don't forget me this weekend!</body> <send /> </note>
All XML Components <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Sample XML Document --> <note id=“112”> <to>Waqas</to> <from>Nadeem</from> <heading>Meeting Reminder</heading> <body>Don't forget me this weekend!</body> <send /> </note>
Well-Formed Document Rules All XML elements must have a closing tag.
Well-Formed Document Rules All XML elements must have a closing tag XML tags are case sensitive
Well-Formed Document Rules All XML elements must have a closing tag XML tags are case sensitive All XML elements must be properly nested
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
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
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 Attributes can not be duplicated in one element.
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
Solution <?xml version="1.0" encoding="UTF-8"?> <mobiles> <mobile> <mobile-code>11-258-745</mobile-code> <brand-name>Nokia</brand-name> <model>6630</model> <color>silver</color> <price>299.99</price> </mobile> <mobile> <mobile-code>11-365-125</mobile-code> <brand-name>Samsung</brand-name> <model>D500</model> <color>black</color> <price>499.99</price> </mobile> </mobiles>
XML Transformation XML does not use predefined tags and the meaning of these tags are not well understood.
XML Transformation XML does not use predefined tags and the meaning of these tags are not well understood. A <table> element could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it.
XML Transformation XML does not use predefined tags and the meaning of these tags are not well understood. A <table> 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
XML Transformation • XML does not use predefined tags and the meaning of these tags are not well understood. • A <table> 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
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 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
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
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
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
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
catalog.xml <?xml version="1.0" encoding="UTF-8"?> <catalog> <cd> <title>Titanic</title> <country>Pakistan</country> <company>Columbia Pictures</company> <price>100</price> <year>2000</year> </cd> <cd> <title>Jurassic Park</title> <country>United Kingdom</country> <company>Paramount Pictures</company> <price>100</price> <year>2002</year> </cd> </catalog>