COS 381 Day 14. Agenda Questions?? Resources Source Code Available for examples in Text Book in Blackboard

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

Defining XML The Document Type Definition. Document Type Definition text syntax for defining –elements of XML –attributes (and possibly default values)
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.
Document Type Definitions
Chapter 10 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 10 Sebesta: Programming the World Wide Web.
COS 381 Day 15. Agenda Assignment 3 Corrected 3 A’s, 1 B, 1 C and 2 D’s Assignment 4 posted Due March 28 Those that wanted to resubmit Assignment 2 must.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
XML Introduction What is XML –XML is the eXtensible Markup Language –Became a W3C Recommendation in 1998 –Tag-based syntax, like HTML –You get to make.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
Introduction to XML This material is based heavily on the tutorial by the same name at
Topics The "bigger picture" –The "XML sales pitch" –XML/XHTML vs. SGML/HTML –XML in electronic publishing –XML and the future, web 2.0 XML basics: –Building.
Copyright © 2003 Pearson Education, Inc. Slide 2-1 Created by Cheryl M. Hughes, Harvard University Extension School — Cambridge, MA The Web Wizard’s Guide.
Chapter 8 Introduction to XML. © 2006 Pearson Addison-Wesley. All rights reserved Introduction - SGML is a meta-markup language - Developed in.
Validating DOCUMENTS with DTDs
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.
Chapter 7 © 2013 by Pearson Introduction - SGML is a meta-markup language - HTML was developed using SGML in the early 1990s - specifically for.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
Chapter 8 © 2003 by Addison-Wesley, Inc. 1 Chapter 8 Introduction to XML.
XML eXtensible Markup Language by Darrell Payne. Experience Logicon / Sterling Federal C, C++, JavaScript/Jscript, Shell Script, Perl XML Training XML.
E X TENSIBLE M ARKUP L ANGUAGE (XML). What is XML?  XML stands for EXtensible Markup Language  XML is mainly designed to carry (or transmit) data, not.
Chapter 7 © 2010 by Addison Wesley Longman, Inc Introduction - SGML is a meta-markup language - Developed in the early 1980s; ISO std. In
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 What is XML? XML v.s. HTML XML Components Well-formed and Valid Document Type Definition (DTD) Extensible Style Language (XSL) SAX and DOM.
Introduction to XML. What is XML? Extensible Markup Language XML Easier-to-use subset of SGML (Standard Generalized Markup Language) XML is a.
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 Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language.
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.
1 Introduction to Web Application Introduction to XML.
1 Tutorial 13 Validating Documents with DTDs Working with Document Type Definitions.
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
Lecture 6 XML DTD Content of.xml fileContent of.dtd file.
1 Chapter 10: XML What is XML What is XML Basic Components of XML Basic Components of XML XPath XPath XQuery XQuery.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter X IXXXXXXXXXX XXXXXX.
Softsmith Infotech XML. Softsmith Infotech XML EXtensible Markup Language XML is a markup language much like HTML Designed to carry data, not to display.
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.
IS432 Semi-Structured Data Lecture 2: DTD Dr. Gamal Al-Shorbagy.
Chapter 7 © 2014 by Pearson Education Introduction - SGML is a meta-markup language - Developed in the early 1980s; ISO std. In HTML was developed.
Chapter 8 Introduction to XML. © 2006 Pearson Addison-Wesley. All rights reserved Introduction - SGML is a meta-markup language - Developed in.
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.
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.
1 Credits Prepared by: Rajendra P. Srivastava Ernst & Young Professor University of Kansas Sponsored by: Ernst & Young, LLP (August 2005) XBRL Module Part.
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.
The eXtensible Markup Language (XML). Presentation Outline Part 1: The basics of creating an XML document Part 2: Developing constraints for a well formed.
INFSY 547: WEB-Based Technologies Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
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.
Well Formed XML The basics. A Simple XML Document Smith Alice.
CS3101: Internet Programming Chapter 06: XML and RSS.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
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 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
7.1 Introduction - SGML is a meta-markup language
Allyson Falkner Spokane County ISD
Presentation transcript:

COS 381 Day 14

Agenda Questions?? Resources Source Code Available for examples in Text Book in Blackboard Html and XHTML examples In Class Work Assignment 3 is creating a board game using JavaScript and DOM Due March 21 Assignment 4 will be posted by next class Due April 1 Quiz 2 in on March 25 JavaScript & DOM Chaps 4-6, 20 5 points each No class on March 28 Discussion on XML

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

7-4 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - SGML is a meta-markup language - Developed in the early 1980s; ISO std. In 1986 (ISO 8879) - HTML was developed using SGML in the early1990s - specifically for Web documents - Two problems with HTML: 1. Fixed set of tags and attributes - User cannot define new tags or attributes - So, the given tags must fit every kind of document, and the tags cannot connote any particular meaning 2. There are no restrictions on arrangement or order of tag appearance in a document - One solution to the first of these problems: Let each group of users define their own tags (with implied meanings) (i.e., design their own “HTML”s using SGML) 7.1 Introduction

7-5 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - Problem with using SGML: - It’s too large and complex to use, and it is very difficult to build a parser for it - A better solution: Define a lite version of SGML - XML is not a replacement for HTML - HTML is a markup language used to describe the layout of any kind of information - XML is a meta-markup language that can be used to define markup languages that can define the meaning of specific kinds of information - XML is a very simple and universal way of storing and transferring data of any kind - XML does not predefine any tags - XML has no hidden specifications - All documents described with an XML-derived markup language can be parsed with a single parser 7.1 Introduction (continued)

7-6 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - We will refer to an XML-based markup language as a tag set - Strictly speaking, a tag set is an XML application, but that terminology can be confusing - XHTML is HTML defined with XML - IE7,FF and Opera all support basic XML Installing Quicktimeplayer will screw uo IE& XML can be written with (Macromedia/Adobe) Dreamweaver, Microsoft Visual Studio.Net, ActiveState Komodo and many other development tools One of the best development tools for XML is Altova xmlspy which is expensive ~$ there is a free 30 day trialhttp:// 7.1 Introduction (continued)

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

7-8 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Basic format for using XML XML Document *.xml Tags, Attributes and Content >> elements Declarations (structural syntactic rules) DTDs Schemas Formatting CSS XSLT

7-9 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Overview

7-10 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7.2 The Syntax of XML Levels of syntax Well-formed documents conform to basic XML rules Valid documents are well-formed and also conform to a schema (or DTD) which defines details of the allowed content Well-formed XML documents All begin tags have a matching end tag Empty tags If a begin tag is inside an element, the matching end tag is also There is one root tag that contains all the other tags in a document Attributes must have a value assigned, the value must be quoted The characters, & can only appear with their special meaning is the official definitionhttp:// Validity is tested against a schema, discussed later

7-11 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7.2 The Syntax of XML -The syntax of XML is in two distinct levels: 1. The general low-level rules that apply to all XML documents 2. For a particular XML tag set, either a document type definition (DTD) or an XML schema General XML Syntax - XML documents have data elements, markup declarations (instructions for the XML parser), and processing instructions (for the application program that is processing the data in the document) - All XML documents begin with an XML declaration: - XML comments are just like HTML comments

7-12 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - XML names: - Must begin with a letter or an underscore - They can include digits, hyphens, and periods - There is no length limitation - They are case sensitive (unlike HTML names) Syntax rules for XML: (similar to those for XHTML) - Every XML document defines a single root element, whose opening tag must appear as the first line of the document - Every element that has content must have a closing tag - Tags must be properly nested - All attribute values must be quoted 7.2 The Syntax of XML (continued)

7-13 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - An XML document that follows all of these rules is well formed 1960 Cessna Centurian Yellow with white trim Gulfport Mississippi 7.2 The Syntax of XML (continued) wellformed.xml

7-14 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - Attributes are not used in XML the way they are in HTML - In XML, you often define a new nested tag to provide more info about the content of a tag - Nested tags are better than attributes, because attributes cannot describe structure and the structural complexity may grow - Attributes should always be used to identify numbers or names of elements (like HTML id and name attributes) The Syntax of XML (continued)

7-15 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Maggie Dee Magpie... Maggie Dee Magpie The Syntax of XML (continued)

7-16 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - An XML document often uses two auxiliary files: - One to specify the structural syntactic rules - One to provide a style specification - An XML document has a single root element, but often consists of one or more entities - Entities range from a single special character to a book chapter - An XML document has one document entity - All other entities are referenced in the document entity - Reasons for entity structure: 1. Large documents are easier to manage 2. Repeated entities need not be literally repeated 3. Binary entities can only be referenced in the document entities (XML is all text!) 7.3 XML Document Structure

7-17 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - When the XML parser encounters a reference to a non-binary entity, the entity is merged in - Entity names: - No length limitation - Must begin with a letter, a dash, or a colon - Can include letters, digits, periods, dashes, underscores, or colons - A reference to an entity has the form: & entity_name ; - One common use of entities is for special characters that may be used for markup delimiters - These are predefined (as in XHTML): < < > > & & " " ' &apos; - The user can only define entities in a DTD 7.3 XML Document Structure

7-18 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - If several predefined entities must appear near each other in a document, it is better to avoid using entity references - Character data section e.g., instead of Start > > > > HERE < < < < use >>> HERE - If the CDATA content has an entity reference, it is taken literally 7.3 XML Document Structure (continued)

7-19 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - A DTD is a set of structural rules called declarations - These rules specify a set of elements, along with how and where they can appear in a document - Purpose: provide a standard form for a collection of XML documents - Not all XML documents have or need a DTD - The DTD for a document can be internal or external - Errors in DTD: Find them early! - All of the declarations of a DTD are enclosed in the block of a DOCTYPE markup declaration - DTD declarations have the form: - There are four possible declaration keywords: ELEMENT, ATTLIST, ENTITY, and NOTATION 7.4 Data Type Definitions

7-20 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - Declaring Elements - Element declarations are similar to BNF - An element declaration specifies the names of an an element, and the element’s structure - If the element is a leaf node of the document tree, its structure is in terms of characters - If it is an internal node, its structure is a list of children elements (either leaf or internal nodes) - General form: e.g., memo fromtodaterebody 7.4 Data Type Definitions (continued)

7-21 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - Declaring Elements (continued) - Child elements can have modifiers, +, *, ? + 1 or More; * 0 or more, ? 0 or 1 e.g., - Leaf nodes specify data types, most often PCDATA, which is an acronym for parsable character data - Data type could also be EMPTY (no content) and ANY (can have any content) - Example of a leaf declaration: - Declaring Attributes - General form: 7.4 Data Type Definitions (continued)

7-22 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - Declaring Attributes (continued) - Attribute types: there are many possible, but we will consider only CDATA - Default values: a value #FIXED value (every element will have this value), #REQUIRED (every instance of the element must have a value specified), or #IMPLIED (no default value and need not specify a value) - e.g., Data Type Definitions (continued)

7-23 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - Declaring Entities - 3 kinds: - A internal entity can be referenced anywhere in the content of an XML document (think of shorthand) - An external entity associates an external file with an internal reference, useful for binary entities - A parameter entity can be referenced only in a markup declaration - General form of declaration: e.g., - A reference: &jfk; - If the entity value is longer than a line, define it in a separate file (an external text entity)  SHOW planes.dtd planes.dtd 7.4 Data Type Definitions (continued)

7-24 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - XML Parsers - Always check for well formedness - Some check for validity, relative to a given DTD - Called validating XML parsers - You can download a validating XML parser from: Online validation - Internal DTDs - External DTDs  SHOW planes.xml planes.xml 7.4 Data Type Definitions (continued)

7-25 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - A markup vocabulary is the collection of all of the element types and attribute names of a markup language (a tag set) - An XML document may define its own tag set and also use that of another tag set - CONFLICTS! - An XML namespace is a collection of names used in XML documents as element types and attribute names - The name of an XML namespace has the form of a URI - A namespace declaration has the form: - The prefix is a short name for the namespace, which is attached to names from the namespace in the XML document - In the document, you can use - Purposes of the prefix: 1. Shorthand 2. URI includes characters that are illegal in XML 7.5 Namespaces

7-26 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley - Can declare two namespaces on one element <gmcars xmlns:gm = " xmlns:html =" - The gmcars element can now use gm names and html names - One namespace can be made the default by leaving the prefix out of the declaration 7.5 Namespaces (continued)