Web Programming Paper Solution (Chapter wise)

Similar documents
11. EXTENSIBLE MARKUP LANGUAGE (XML)

EXtensible Markup Language XML

XML (Extensible Markup Language)

XML. Objectives. Duration. Audience. Pre-Requisites

PODCASTS, from A to P

XSL Languages. Adding styles to HTML elements are simple. Telling a browser to display an element in a special font or color, is easy with CSS.

What is XML? XML is designed to transport and store data.

Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013


SATORI READER USER MANUAL. Satori Team

The components of a basic XML system.

PODCASTS, from A to P

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 7 XML

COMP9321 Web Application Engineering. Extensible Markup Language (XML)

CSI 3140 WWW Structures, Techniques and Standards. Representing Web Data: XML

7.1 Introduction. extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML

User Interaction: XML and JSON

Delivery Options: Attend face-to-face in the classroom or via remote-live attendance.

Data formats. { "firstname": "John", "lastname" : "Smith", "age" : 25, "address" : { "streetaddress": "21 2nd Street",

COMP9321 Web Application Engineering

XML: Introduction. !important Declaration... 9:11 #FIXED... 7:5 #IMPLIED... 7:5 #REQUIRED... Directive... 9:11

8/1/2016. XSL stands for EXtensible Stylesheet Language. CSS = Style Sheets for HTML XSL = Style Sheets for XML. XSL consists of four parts:

IT2353 WEB TECHNOLOGY Question Bank UNIT I 1. What is the difference between node and host? 2. What is the purpose of routers? 3. Define protocol. 4.

XML Extensible Markup Language

XML. Marie Dubremetz Uppsala, April 2014

XML. Jonathan Geisler. April 18, 2008

Delivery Options: Attend face-to-face in the classroom or remote-live attendance.

Shankersinh Vaghela Bapu Institue of Technology

The main Topics in this lecture are:

Structured documents

Introduction to XML. XML: basic elements

E-Applications. XML and DOM in Javascript. Michail Lampis

COMP9321 Web Application Engineering

Languages in WEB. E-Business Technologies. Summer Semester Submitted to. Prof. Dr. Eduard Heindl. Prepared by

Bioinforma)cs Resources XML / Web Access

Introduction to XML. Asst. Prof. Dr. Kanda Runapongsa Saikaew Dept. of Computer Engineering Khon Kaen University

Alpha College of Engineering and Technology. Question Bank

User Interaction: XML and JSON

INTERNET & WEB APPLICATION DEVELOPMENT SWE 444. Fall Semester (081) Module 4 (III): XSL

Introduction Syntax and Usage XML Databases Java Tutorial XML. November 5, 2008 XML

Introduction to XML 3/14/12. Introduction to XML

XML for Java Developers G Session 2 - Sub-Topic 1 Beginning XML. Dr. Jean-Claude Franchitti

Web Services Part I. XML Web Services. Instructor: Dr. Wei Ding Fall 2009

XML. Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior

The <schema> Element. <?xml version="1.0"?> <xs:schema>... </xs:schema>

XML: a "skeleton" for creating markup languages you already know it! <element attribute="value">content</element> languages written in XML specify:

Comp 336/436 - Markup Languages. Fall Semester Week 4. Dr Nick Hayward

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id

Introduction to XML. M2 MIA, Grenoble Université. François Faure

User Interaction: XML and JSON

XML CSC 443: Web Programming

Comp 336/436 - Markup Languages. Fall Semester Week 4. Dr Nick Hayward

Extensible Markup Language (XML) What is XML? An example XML file. CSE 190 M (Web Programming), Spring 2008 University of Washington

COP 4814 Florida International University Kip Irvine XSLT. Updated: 2/9/2016 Based on Goldberg, Chapter 2. Irvine COP 4814

Building Dynamic Forms with XML, XSLT

CLASS DISCUSSION AND NOTES

COPYRIGHTED MATERIAL. Contents. Part I: Introduction 1. Chapter 1: What Is XML? 3. Chapter 2: Well-Formed XML 23. Acknowledgments

- XML. - DTDs - XML Schema - XSLT. Web Services. - Well-formedness is a REQUIRED check on XML documents

HTML. Mohammed Alhessi M.Sc. Geomatics Engineering. Internet GIS Technologies كلية اآلداب - قسم الجغرافيا نظم المعلومات الجغرافية

Style Sheet A. Bellaachia Page: 22

INTERNET PROGRAMMING XML

XML extensible Markup Language

Software Engineering Methods, XML extensible Markup Language. Tutorial Outline. An Example File: Note.xml XML 1

Extensible Markup Language (XML) What is XML? Structure of an XML document. CSE 190 M (Web Programming), Spring 2007 University of Washington

Chapter 1: Getting Started. You will learn:

markup language carry data define your own tags self-descriptive W3C Recommendation

Exam : Title : XML 1.1 and Related Technologies. Version : DEMO

XML and XSLT. XML and XSLT 10 February

Web Programming. Meta-markup Languages

W3C XML XML Overview

Data Presentation and Markup Languages

<?xml version = 1.0 encoding= windows-874?> <?xml-stylesheet type= text/css href= #xmldocs?> <style id= xmldocs > element-name{ } </style>

Introduction to XSLT. Version 1.0 July nikos dimitrakas

The XML Metalanguage

Birkbeck (University of London)

Inf 202 Introduction to Data and Databases (Spring 2010)

UNIT-II : VIRTUALIZATION & COMMON STANDARDS IN CLOUD COMPUTING

XML, XPath, and XSLT. Jim Fawcett Software Modeling Copyright

Introduction to XML. When talking about XML, here are some terms that would be helpful:

More XML Schemas, XSLT, Intro to PHP. CS174 Chris Pollett Oct 15, 2007.

Display the XML Files for Disclosure to Public by Using User-defined XSL Zhiping Yan, BeiGene, Beijing, China Huadan Li, BeiGene, Beijing, China

Semantic Web. XSLT: XML Transformation. Morteza Amini. Sharif University of Technology Fall 95-96

XML (Extensible Markup Language

5/19/2015. Objectives. JavaScript, Sixth Edition. Introduction to the World Wide Web (cont d.) Introduction to the World Wide Web

XML. Presented by : Guerreiro João Thanh Truong Cong

INTERNET & WEB APPLICATION DEVELOPMENT SWE 444. Fall Semester (081) Module 4 (VII): XML DOM

but XML goes far beyond HTML: it describes data

Hypermedia and the Web XSLT and XPath

CSS, Cascading Style Sheets

AJAX Programming Overview. Introduction. Overview

Tutorial 1 Getting Started with HTML5. HTML, CSS, and Dynamic HTML 5 TH EDITION

Chapter 2 XML, XML Schema, XSLT, and XPath

INLS 760 Web Databases Lecture 12 XML, XPATH, XSLT

JavaScript CS 4640 Programming Languages for Web Applications

Outline. XML vs. HTML and Well Formed vs. Valid. XML Overview. CSC309 Tutorial --XML 4. Edward Xia

HTML 5 and CSS 3, Illustrated Complete. Unit M: Integrating Social Media Tools


Web Standards Mastering HTML5, CSS3, and XML

Extensions to XSLT 1.0, and XSLT 2.0

Chapter 2:- Introduction to XHTML. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

Transcription:

What is valid XML document? Design an XML document for address book If in XML document All tags are properly closed All tags are properly nested They have a single root element XML document forms XML tree If its tags are cross checked with XML DTD and found correct Then such a XML document is valid document Example <?xml version="10" encoding="utf-8"?> <address_book> <person> <number>1</number> <name>xyz</name> <mobile>123</mobile> <person> <number>2</number> <name>abc</name> <mobile>234</mobile> <person> <number>4</number> <name>des</name> <mobile>2344</mobile> </address_book> Page 1 of 8

XML v/s HTML XML stands for extensible Markup Language where as HTML stands for HyperText Markup Language XML is designed to store and transport data where as HTML is designed to display data XML don't have predefined tags as in HTML In XML user can invent its own tags where as HTML to use its own have predefined tags only XML do nothing in manipulation of data but HTML can format data Main point in XML is what data is where as in HTML how data will look XML separates data from HTML, where as HTML does not separate XML transports data between users without depending on database handling applications where as HTML depends upon database applications and scripting language XML can simplifies data transport between incompatible systems where as HTML does not have such facility Change of platform and application in XML does not impact on data transport, but HTML pages depend upon database applications and scripting language XML data are very less in size comparing to other XML is used to create new languages such as XHTML, WSDL, RSS, SMIL where as HTML uses other language to perform some basic operation XML must have closing tag where as in HTML it is optional XML tags are case sensitive where as HTML tags are not XML element if not properly nested then will create wrong result where as HTML will create near result In XML attribute values must be quoted which is optional in some case of HTML In XML white spaces are preserved where as in HTML multiple white spaces are treated as one white space XML is more well form document than HTML XML example <?xml version="10" encoding="utf-8"?> <subject> <name>wp</name> <fullform>web Programming</fullForm> <sem>iv</sem> <branch>it</branch> </subject> HTML example <!doctype html> <html> <head> <title>html</title> </head> <body>hi</body> </html> Page 2 of 8

XML DTD An XML document with correct syntax is called "Well Formed" An XML document validated against a DTD is "Well Formed" and "Valid" XML DTD The purpose of a DTD is to define the structure of an XML document It defines the structure with a list of legal elements: <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]> The DTD above is interpreted like this:!doctype note defines that the root element of the document is note!element note defines that the note element contains four elements: "to, from, heading, body"!element to defines the to element to be of type "#PCDATA"!ELEMENT from defines the from element to be of type "#PCDATA"!ELEMENT heading defines the heading element to be of type "#PCDATA"!ELEMENT body defines the body element to be of type "#PCDATA" Why Use a DTD? With a DTD, your XML files can carry a description of its own format With a DTD, independent groups of people can agree on a standard for interchanging data With a DTD, you can verify that the data you receive from the outside world is valid Page 3 of 8

XML attributes and elements XML element is everything that is included between start tag to end tag (both inclusive) XML element contains 1 Other elements 2 text 3 attributes 4 or mix of all from above <bookstore> <book category="children"> <title>harry Potter</title> <author>j K Rowling</author> <year>2005</year> <price>2999</price> </book> <book category="web"> <title>learning XML</title> <author>erik T Ray</author> <year>2003</year> <price>3995</price> </book> </bookstore> An element with empty content can be written as <ele></ele> or <ele /> XML element name can not contain spaces, they can contain alpha-num and other characters XML element can not start with number, non alpha characters or xml It is always better to have element rather than attribute, ex <person gender="male"> <firstname>abc</firstname> <lastname>xyz</lastname> should be replace by <person> <gender>male</gender> <firstname>abc</firstname> <lastname>xyz</lastname> Attributes can not contain multiple values, they can not contain tree structure and they are not expandables But element can do all this things Hence element are preffered than attribute Page 4 of 8

XSL or XSLT with example XSL is stylesheet that can be used to transform XML documents into another document types and to format data Since the XML does not have predefined tags, hence there should be some way to tell browser how to interpret the information in XML XSL consist of three parts : 1 XSLT : With XSLT you can transform an XML document into HTML XSLT (extensible Stylesheet Language Transformations) is the recommended style sheet language for XML XSLT is far more sophisticated than CSS With XSLT you can add/remove elements and attributes to or from the output file You can also rearrange and sort elements, perform tests and make decisions about which elements to hide and display, and a lot more XSLT uses XPath to find information in an XML document 2XPath : is a language that defines parts of an XML document and access parts of XML in XSLT 3 XSLFO : XSL Formatting Objects can work both on screen and print, they specify format of XML document To include XSL stylesheet in XML write code as <?xml-stylesheet type="text/xsl" href="xslfilenamexsl"?> How to write XML stylesheet (XSL) XSL declaration <?xml version="10" encoding="utf-8"?> <xsl:stylesheet version="10" xmlns:xsl="http://wwww3org/1999/xsl/transform"> </xsl:stylesheet> <xsl:template> element The <xsl:template> 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 (ie match="/" defines the whole document) so write this element as <xsl:template match="/"> </xsl:template> <xsl:value-of> element The <xsl:value-of> element is used to extract the value of a selected node Ex <xsl:value-of select="xmlelementname OR xmlelementusingtree" /> Page 5 of 8

But this will produce only one record not all, for that use <xsl:for-each> element <xsl:for-each> element The <xsl:for-each> element allows you to do looping in XSL ex <xsl:for-each select="xmlelementname OR xmlelementusingtree"> <xsl:value-of select="xmlelementname"/> <xsl:value-of select="xmlelementname "/> </xsl:for-each> The <xsl:sort> element is used to sort the output The <xsl:sort> element is used to sort the output To sort the output, simply add an <xsl:sort> element inside the <xsl:for-each> element in the XSL file Ex <xsl:for-each select="xmlelementname OR xmlelementusingtree"> <xsl:sort select="xmlelementname"/> <xsl:value-of select="xmlelementname"/> <xsl:value-of select="xmlelementname "/> </xsl:for-each> Page 6 of 8

AJAX AJAX stands for Asynchronous JavaScript and XML AJAX is a new technique for creating better, faster, and more interactive web applications with the help of XML, HTML, CSS, and Java Script Ajax uses XHTML for content, CSS for presentation, along with Document Object Model and JavaScript for dynamic content display Conventional web applications transmit information to and from the server using synchronous requests It means you fill out a form, hit submit, and get directed to a new page with new information from the server With AJAX, when you hit submit, JavaScript will make a request to the server, interpret the results, and update the current screen In the purest sense, the user would never know that anything was even transmitted to the server XML is commonly used as the format for receiving server data, although any format, including plain text, can be used AJAX is a web browser technology independent of web server software A user can continue to use the application while the client program requests information from the server in the background Intuitive and natural user interaction Clicking is not required; mouse movement is a sufficient event trigger Data-driven as opposed to page-driven Example: <!doctype html> <html> <head> <title>ajax</title> <script> function showtext() { var xmlhttp = new XMLHttpRequest(); xmlhttpopen("get", "hellotxt", false); xmlhttpsend(null); documentgetelementbyid("x")innerhtml = xmlhttpresponsetext; } </script> </head> <body> <div id="x"></div> <input type="button" name="showtext" value="show Text" onclick="showtext()" /> </body> </html> Page 7 of 8

RSS RSS (Rich Site Summary) is a format for delivering regularly changing web content Many news-related sites, weblogs and other online publishers syndicate their content as an RSS Feed to whoever wants it RSS solves a problem for people who regularly use the web It allows you to easily stay informed by retrieving the latest content from the sites you are interested in You save time by not needing to visit each site individually You ensure your privacy, by not needing to join each site's email newsletter The number of sites offering RSS feeds is growing rapidly and includes big names like Yahoo News How to get RSS feed? Feed Reader or News Aggregator software allow you to grab the RSS feeds from various sites and display them for you to read and use A variety of RSS Readers are available for different platforms Some popular feed readers include Amphetadesk (Windows, Linux, Mac), FeedReader (Windows), and NewsGator (Windows - integrates with Outlook) There are also a number of web-based feed readers available My Yahoo, Bloglines, and Google Reader are popular web-based feed readers Once you have your Feed Reader, it is a matter of finding sites that syndicate content and adding their RSS feed to the list of feeds your Feed Reader checks Many sites display a small icon with the acronyms RSS, XML, or RDF to let you know a feed is available RSS and XML RSS defines an XML grammar (a set of HTML-like tags) for sharing news Each RSS text file contains both static information about your site, plus dynamic information about your new stories, all surrounded by matching start and end tags Each story is defined by an <item> tag, which contains a headline TITLE, URL, and DESCRIPTION Here's an example: <item> <title>rss Resources</title> <link>http://wwwwebreferencecom/authoring/languages/xml/rss/</link> <description>defined in XML, the Rich Site Summary (RSS) format has quietly become a dominant format for distributing headlines on the Web Our list of links gives you the tools, tips and tutorials you need to get started using RSS 0323</description> </item> Each RSS channel can contain up to 15 items and is easily parsed using Perl or other open source software Once created and validated your RSS text file, register it at the various aggregators, and it will have hits Any site can now grab and display your feed regularly, driving traffic your way Update your RSS file, and all the external sites that subscribe to your feed will be automatically updated Page 8 of 8