XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.

Slides:



Advertisements
Similar presentations
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.
Advertisements

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.
XML Document Type Definitions ( DTD ). 1.Introduction to DTD An XML document may have an optional DTD, which defines the document’s grammar. Since the.
A Technical Introduction to XML Transparency No. 1 XML quick References.
Extensible Markup Language XML MIS 520 – Database Theory Fall 2001 (Day) Lecture 14.
Structured Documents KA1 Document Type definition DTD.
Tutorial 11 Creating XML Document
COS 381 Day 14. Agenda Questions?? Resources Source Code Available for examples in Text Book in Blackboard
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
XML Basics Hope Greenberg Center for Teaching & Learning.
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.
XML introduction to Ahmed I. Deeb Dr. Anwar Mousa  presenter  instructor University Of Palestine-2009.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
XML eXtensible Markup Language by Darrell Payne. Experience Logicon / Sterling Federal C, C++, JavaScript/Jscript, Shell Script, Perl XML Training XML.
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.
XML - DTD. The building blocks of XML documents Elements, Tags, Attributes, Entities, PCDATA, and CDATA.
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.
These Questions are copied from
XML (2) DTD Sungchul Hong.
Electronic Commerce COMP3210 Session 4: Designing, Building and Evaluating e-Commerce Initiatives – Part II Dr. Paul Walcott Department of Computer Science,
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.
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.
XML - DTD Week 4 Anthony Borquez. What can XML do? provides an application independent way of sharing data. independent groups of people can agree to.
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.
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.
17 Apr 2002 XML Syntax: Documents Andy Clark. Basic Document Structure Element tags – Elements have associated attributes Text content Miscellaneous –
Lecture 16 Introduction to XML Boriana Koleva Room: C54
XML EXtensible Markup Language. Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA.
Web Technologies COMP6115 Session 4: Adding a Database to a Web Site Dr. Paul Walcott Department of Computer Science, Mathematics and Physics University.
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
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Understanding How XML Works Ellen Pearlman Eileen Mullin Programming the.
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
1 Dr Alexiei Dingli XML Technologies DTD. 2 Document Type Definition Defines –the legal building blocks of an XML document –the document structure –The.
The eXtensible Markup Language (XML). Presentation Outline Part 1: The basics of creating an XML document Part 2: Developing constraints for a well formed.
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.
INFSY 547: WEB-Based Technologies Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
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.
What is XML? eXtensible Markup Language eXtensible Markup Language A subset of SGML (Standard Generalized Markup Language) A subset of SGML (Standard Generalized.
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 DTD. XML Validation XML with correct syntax is "Well Formed" XML. XML validated against a DTD is "Valid" XML.
XML blocks XML STRUCTURE The most basic building blocks of an XML file are elements, attributes and comments. Compiled based on Tutorial PhUSE 2008 XML.
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.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
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
The XML Language.
Allyson Falkner Spokane County ISD
Review of XML IST 421 Spring 2004 Lecture 5.
Presentation transcript:

XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document Type

Components of XML Systems XML Parser (Processor) XML Application XML Document (Contents) XML DTD (Rule) Well-Formed (Syntax) Validate (Structure)

Further Processing (optional) How a Parser Interprets XML - Validate XML Document Data Type Definition Issue Warning/Stop Processing Well Formed? DTD? Valid? Issue Warning/Stop Processing no yes

XML Document Syntax  Processing Instructions (PI)  Document Type Declarations (optional)  Comments (optional)  Element Start and End Tags  Attributes  Entity References  Character Data Sections (CDATA)

The Panoramic Perspective of XML XML Document Prolog Doc. Type Declaration Root Element Comments Processing Instructions Comments Processing Instructions Comments Processing Instructions Entity References CDATA Sections Elements PCDATA Attributes Entity References CDATA, Entities, ID,.. Doc Type Definitions Element Declaration Attribute Declaration Entity Declaration Notations Declaration : Optional

An Example of XML Document Alley Gator 001 (010) Main Street Muddy Waters FL Process Instruction Elements Root Element Document Type Declaration

Processing Instructions (PI)  PI is used to provide information regarding processing such as processor (name and version of the processor) Syntax:  Examples:  DTD File

Document Type Declaration  A statement embedded in an XML document whose purpose is to point to the existence and location of a document type definition (DTD).  DTD is optional. Syntax: Example:

Comments  A place to write a note for reminding, simple documentation, or commenting out codes for debugging, etc., which will not be seen by the end users. <!-- This is a comment area -->  You can use any character inside the comment area except “--” itself  There is no limitation on the length of the comment area.  Comments may not come before the XML declaration.  Comments may not be placed inside a tag.

Guideline for Elements  Elements are the building blocks of XML documents.  Every document needs to have one and only one root element.  An element must start with a starting tag and ends with a corresponding ending tag.  Element names are case sensitive. Element names must open and close with identical cases.  Spaces are not allowed between the forward slash and element name.

Example of Element Tag Name Attribute Name Attribute Value Attribute End Tag Start Tag Element Contents Texts Elements Element

Guideline for Elements  Elements can be used to both contain information and define structure.  The structure of information is encoded by the nesting of tags.  Empty elements, which don’t have contents, are being used as placeholders or to signify their existence E.G.,.

Tree Diagram of Address Document Address_ Book Contact IDName PhoneAddress ZipStateCityStreet Root Element

Element Name  Element names must begin with a letter or an underscore (_). Subsequent characters may include letters, digits, underscore, hyphens, and periods.  Element names cannot begin with a number.  Element names cannot include spaces.

Instant Quiz   _______ _______ Which of the flowing are “legal” or “illegal” element name?

Attributes  Attributes are small descriptive bits of information used for describing elements.  Attributes are contained within the start tag of an element after the element name and are followed by an “=“ sign, then the value of the attribute.  The attributes value must be enclosed with a pair of single or double quotes.

Instant Quiz 1. _____ 2. _____ 3. _____ 4. _____ 5. _____ Which of the followings are legal attributes?

CDATA Section  CDATA sections are used when you want all text to be interpreted as pure character data rather than as markup. This is useful if you have a lot of, & or “ characters. Example:

Entity References  Entity references are markup that is replaced with character data when the document is parsed.  XML predefines five entity references: & & < < > > " “ &apos; ‘  Entity references point to either external text file or external picture.

Illustration of Entity Reference XML Document Entity Reference Entity Reference Text File Before

Illustration of Entity Reference XML Document After Parsing Text Contents

Well Formed Document Here are some general guidelines:  Contains one and only one root element.  All elements must contain both start and end tags.  Tags are case sensitive  No overlapping tags. Elements must nest inside each other properly.  Attribute values must be enclosed in quotes.  An empty element must end with “/>”  The text characters ( ) and (“) must always be represented by character entities. Well formed XML documents are those documents that are syntactically correct.

Thank You? Any Question?