Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

XML I.
What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
XML: text format Dr Andy Evans. Text-based data formats As data space has become cheaper, people have moved away from binary data formats. Text easier.
An Introduction to XML Based on the W3C XML Recommendations.
XML 6.3 DTD 6. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:  Elements.
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
Document Type Definitions
Introduction to XLink Transparency No. 1 XML Information Set W3C Recommendation 24 October 2001 (1stEdition) 4 February 2004 (2ndEdition) Cheng-Chia Chen.
Thayer School of Engineering Dartmouth Lecture 2 Overview Web Services concept XML introduction Visual Studio.net.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Tutorial 11 Creating XML Document
Introduction to XML: Yong Choi CSU Bakersfield.
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
Introducing XHTML: Module B: HTML to XHTML. Goals Understand how XHTML evolved as a language for Web delivery Understand the importance of DTDs Understand.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
Copyright © 2003 Pearson Education, Inc. Slide 2-1 Created by Cheryl M. Hughes, Harvard University Extension School — Cambridge, MA The Web Wizard’s Guide.
ECA 228 Internet/Intranet Design I Intro to XML. ECA 228 Internet/Intranet Design I HTML markup language very loose standards browsers adjust for non-standard.
Pemrograman Berbasis WEB XML part 2 -Aurelio Rahmadian- Sumber: w3cschools.com.
XML introduction to Ahmed I. Deeb Dr. Anwar Mousa  presenter  instructor University Of Palestine-2009.
Validating DOCUMENTS with DTDs
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
XP Tutorial 9New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
XML CPSC 315 – Programming Studio Fall 2008 Project 3, Lecture 1.
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
Document Type Definitions Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
August Chapter 2 - Markup and Core Concepts Learning XML by Erik T. Ray Slides were developed by Jack Davis College of Information Science and Technology.
XML Syntax - Writing XML and Designing DTD's
What is XML?  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 is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
Tutorial 1: XML Creating an XML Document. 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content.
1 Tutorial 13 Validating Documents with DTDs Working with Document Type Definitions.
1 Chapter 10: XML What is XML What is XML Basic Components of XML Basic Components of XML XPath XPath XQuery XQuery.
Softsmith Infotech XML. Softsmith Infotech XML EXtensible Markup Language XML is a markup language much like HTML Designed to carry data, not to display.
E0262 – MIS – Multimedia Storage Techniques XML (Extensible Markup Language  XML is a markup language for creating documents containing structured information.
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation An Introduction to XML.
XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
XML Instructor: Charles Moen CSCI/CINF XML  Extensible Markup Language  A set of rules that allow you to create your own markup language  Designed.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
Lecture 16 Introduction to XML Boriana Koleva Room: C54
1 Introduction to XML XML stands for Extensible Markup Language. Because it is extensible, XML has been used to create a wide variety of different markup.
An Introduction to XML Sandeep Bhattaram
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
What it is and how it works
XML Design Goals 1.XML must be easily usable over the Internet 2.XML must support a wide variety of applications 3.XML must be compatible with SGML 4.It.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
C# and Windows Programming XML Processing. 2 Contents Markup XML DTDs XML Parsers DOM.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
225 City Avenue, Suite 106 Bala Cynwyd, PA , phone , fax presents… XML Syntax v2.0.
Web Technologies Lecture 4 XML and XHTML. XML Extensible Markup Language Set of rules for encoding a document in a format readable – By humans, and –
Well Formed XML The basics. A Simple XML Document Smith Alice.
Introduction to DTD A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
XML CORE CSC1310 Fall XML DOCUMENT XML document XML document is a convenient way for parsers to archive data. In other words, it is a way to describe.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
XML Extensible Markup Language
XML Introduction to XML Extensible Markup Language.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Extensible Markup Language (XML) Pat Morin COMP 2405.
Unit 4 Representing Web Data: XML
Chapter 7 Representing Web Data: XML
An Introduction to JavaScript
Allyson Falkner Spokane County ISD
Presentation transcript:

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Textbook to be published by Pearson Ed in early Fundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar © 2015 Pearson XML Extensible Markup Language Chapter

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML OVERVIEW Section 1 of 7

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Overview XML is a text-based markup language, but unlike HTML, XML can be used to mark up any type of data. Derived from Standard Generalized Markup Language SGML One of the key benefits of XML data is that as plain text, it can be read and transferred between applications and different operating systems as well as being human-readable and understandable as well. XML is not only used on the web server and to communicate asynchronously with the browser, but is also used as a data interchange format for moving information between systems Introduction

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Overview XML in the web context - Used in many systems

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Well Formed XML Syntax Rules For a document to be well-formed XML, it must follow the syntax rules for XML: Element names are composed of any of the valid characters (most punctuation symbols and spaces are not allowed) in XML. Element names can’t start with a number. There must be a single-root element. A root element is one that contains all the other elements; for instance, in an HTML document, the root element is. All elements must have a closing element (or be self-closing). Elements must be properly nested. Elements can contain attributes. Attribute values must always be within quotes. Element and attribute names are case sensitive.

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Well Formed XML Sample Document XML declaration is analogous to HTML DOCTYPE

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Valid XML Requires a DTD A valid XML document is one that is well formed and whose element and content conform to the rules of either its document type definition (DTD) or its schema. A DTD tells the XML parser which elements and attributes to expect in the document as well as the order and nesting of those elements. A DTD can be defined within an XML document or within an external file.

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML parser Verifies that an XML document is well formed. Checks xml document for syntax errors Converts XML document into some type of internal memory structure All contemporary browsers have built-in parsers as do most web development environments such as PHP and ASP.NET Meaning

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Data Type Definition Example

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Data Type Definition Example The main drawback with DTDs is that they can only validate the existence and ordering of elements. They provide no way to validate the values of attributes or the textual content of elements. For this type of validation, one must instead use XML schemas, which have the added advantage of using XML syntax. Unfortunately, schemas have the corresponding disadvantage of being long-winded and harder for humans to read and comprehend; for this reason, they are typically created with tools.

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Schema Just one example

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XSLT XML Stylesheet Transformations XSLT is an XML-based programming language that is used for transforming XML into other document formats

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XSLT Another usage XSLT is also used on the server side and within JavaScript

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XSLT Example XSLT document that converts the XML from Listing 17.1 into an HTML list

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XSLT An XML parser is still needed to perform the actual transformation

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XPath Another XML Technology XPath is a standardized syntax for searching an XML document and for navigating to elements within the XML document XPath is typically used as part of the programmatic manipulation of an XML document in PHP and other languages XPath uses a syntax that is similar to the one used in most operating systems to access directories.

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XPath Learn through example

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Textbook to be published by Pearson Ed in early Fundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar © 2015 Pearson XML Tutorial

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Basics XML tags identify the data and are used to store and organize the data, rather than specifying how to display it like HTML tags XML Characteristics XML is extensible: XML allows you to create your own self-descriptive tags, or language, that suits your application. XML carries the data, does not present it: XML allows you to store the data irrespective of how it will be presented. XML is a public standard: XML was developed by an organization called the World Wide Web Consortium (W3C) and is available as an open standard. Before proceeding with this tutorial you should have basic knowledge of HTML and Javascript. XML Tutorial

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Usage XML can work behind the scene to simplify the creation of HTML for large web sites. XML can be used to exchange the information between organizations and systems. XML can be used for offloading and reloading of databases. XML can be used to store and arrange the data, which can customize your data handling needs. XML can easily be merged with style sheets to create almost any desired output. Virtually, any type of data can be expressed as an XML document. Not a programming language it does not perform any computation or algorithms. It is usually stored in a simple text file and is processed by special software that is capable of interpreting XML. list of XML usage

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Syntax Hello, world! Tanmay Patil TutorialsPoint (011) Two kinds of information in the above example:  The markup, like and  The text, or the character data, Tutorials Point and (040) Syntax Rules

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Declaration The XML declaration is case sensitive and must begin with " " where "xml" is written in lower-case. If document contains XML declaration, then it strictly needs to be the first statement of the XML document. An HTTP protocol can override the value of encoding that you put in the XML declaration. Syntax Rules for Tags and Elements

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Syntax Rules for Tags and Elements XML-elements or XML-nodes or XML tags. XML-elements names are enclosed by triangular brackets.. or in simple-cases Nesting of elements: can contain multiple XML-elements as its children, but the children elements must not overlap Elements Which is correct ?

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Syntax Rules for Tags and Elements Only one root element Case sensitive ≠ Element attribute (single property); one or more attributes. For example: Tutorialspoint!.... correct? Attribute names are defined without quotation marks, whereas attribute values must always appear in quotation marks.... correct? XML References begin with the "&”and ends with the symbol ";” Entity References: & Character References contains a hash mark (“#”) followed by a number. The number always refers to the Unicode code of a character. In this case, 65 refers to alphabet "A". Root, Attributes, XML References: Entity and Character Which is correct ?

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Text XML-elements attributes names are case-sensitive, start and end name need to be written in the same case. To avoid character encoding problems, all XML files should be saved as Unicode UTF-8 or UTF-16 files. Whitespace characters like blanks, tabs and line-breaks between XML-elements and between the XML-attributes will be ignored. Some characters are reserved by the XML syntax. Encoding

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Documents Document prolog comes at the top of the document, before the root element. It contains:  XML declaration  Document type declaration Document Elements are the building blocks of XML, a hierarchy of sections, each serving a specific purpose. The elements can be containers, with a combination of text and other elements. Document Prolog and Elements

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Declaration XML declaration contains details that prepare an XML processor to parse the XML document. It is optional, but when it is used, it must appear in first line of the XML document.Syntax Syntax

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Declaration If present in the XML, it must be placed as the first line in the XML document. If included, it must contain version number attribute. The Parameter names and values are case-sensitive. The names are always in lower case. The order of placing the parameters is important. The correct order is: version, encoding and standalone. Either single or double quotes may be used. The XML declaration has no closing tag i.e. XML declaration with version definition: XML declaration with all parameters defined: XML declaration with all parameters defined in single quotes: Rules

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Tags Start Tag End Tag Empty Tag ot may be used for any element which has no content Rules 1.XML tags are case-sensitive This is wrong syntax correct? 2.XML tags must be closed in an appropriate order This tag is closed before the outer_element Definition and Rules

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Elements XML elements can be defined as building blocks of an XML. Elements can behave containers to hold text, elements, attributes, media objects or all of these. Each XML document contains one or more elements, the scope of which are delimited by start and end tags, or for empty elements, by an empty-element tag, separated by white spaces It associates a name with a value, which is a string of characters. An attribute is written as: name = "value” double(" ") or single(' ') quotes Empty Element (no content)

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Elements Rules An element name can contain any alphanumeric characters. The only punctuation marks allowed in names are the hyphen (-), under-score (_) and period (.). Names are case sensitive. For example, Address, address, and ADDRESS are different names. Start and end tags of an element must be identical. An element, which is a container, can contain text or elements as seen in the above example.

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Attributes An element can have multiple unique attributes or properties is always a name-value pair. An XML attribute has following syntax....content.. where attribute1 and attribute2 has the following form: name = "value” Attributes are used to add a unique label to an element, place the label in a category, add a Boolean flag, or otherwise associate it with some string of data. Attributes are part of the XML elements, Syntax Two categories of plants, one flowers and other color. Hence we have two plant elements with different attributes.

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Attribute Types Attribute TypeDescription StringTypeIt takes any literal string as a value. CDATA is a StringType. CDATA is character data. This means, any string of non-markup characters is a legal part of the attribute. TokenizedTypeThis is more constrained type. The validity constraints noted in the grammar are applied after the attribute value is normalized. The TokenizedType attributes are given as: ID: It is used to specify the element as unique. IDREF: It is used to reference an ID that has been named for another element. IDREFS: It is used to reference all IDs of an element. ENTITY: It indicates that the attribute will represent an external entity in the document. ENTITIES: It indicates that the attribute will represent external entities in the document. NMTOKEN: It is similar to CDATA with restrictions on what data can be part of the attribute. NMTOKENS: It is similar to CDATA with restrictions on what data can be part of the attribute. numeratedType This has a list of predefined values in its declaration. out of which, it must assign one value. There are two types of enumerated attribute: NotationType: declares that an element will be referenced to a NOTATION declared somewhere else in the XML document. Enumeration: defines a specific list of values that the attribute value must match

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Element Attribute Rules An attribute name must not appear more than once in the same start-tag or empty-element tag. An attribute must be declared in the Document Type Definition (DTD) using an Attribute-List Declaration. Attribute values must not contain direct or indirect entity references to external entities. The replacement text of any entity referred to directly or indirectly in an attribute value must not contain either less than sign <

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Comments Tanmay A Any text between

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Character Entities W3C: “The document entity serves as the root of the entity tree and a starting- point for an XML processor.” declared in the document prolog or in a DTD Types of Character Entities There are three types of character entities: 1.Predefined Character Entities: Ampersand: & Single quote: &apos; Greater than: > Less than: < Double quote: " 2.Numbered Character Entities: &# decimal number; #x Hexadecimal number; 3.Named Character Entities 'Acute’ 'ugrave’

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML CDATA Sections Defined as blocks of text that are not parsed by the parser, but are otherwise recognized as markup. The predefined entities such as <, >, and & require typing and are generally difficult to read in the markup. In such cases, CDATA section can be used The above syntax is composed of three sections: 1.CDATA Start section - CDATA begins with the nine-character delimiter <![CDATA[ 2.CDATA End section - CDATA section ends with ]]> delimiter. 3.CData section - Characters between these two enclosures are interpreted as characters, and not as markup. This section may contain markup characters (, and &), but they are ignored by the XML processor Character Data CDATA ignored by the parser treated as character data and not as markup.

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar CDATA Rules CDATA cannot contain the string "]]>" anywhere in the XML document. Nesting is not allowed in CDATA section. spaces, tabs, and newlines

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar XML Whitespaces TanmayPatil different? Tanmay Patil different? A special attribute named xml:space may be attached to an element. This indicates that whitespace should not be removed for that element by the application. You can set this attribute to default or preserve as shown in the example below: Where: The value default signals that the default whitespace processing modes of an application are acceptable for this element; The value preserve indicates the application to preserve all the whitespaces.

Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar xml XML Processing is not included page 34 stop XML Quick Guide pdf