225 City Avenue, Suite 106 Bala Cynwyd, PA 19004 610.206.0101, phone 610.206.0102, fax www.learnquest.com presents… XML Syntax v2.0.

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

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.
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.
Extensible Markup Language XML MIS 520 – Database Theory Fall 2001 (Day) Lecture 14.
XML: New or Old? XML was not an extention of HTML That already existed! SGML (ISO 8879) XML was a simplification of SGML  80 / 20 rule  (80% of the features.
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
Tutorial 11 Creating XML Document
XML Fundamentals Transparency No. 1 XML Fundamentals Cheng-Chia Chen November 2004.
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:
Introducing XHTML: Module B: HTML to XHTML. Goals Understand how XHTML evolved as a language for Web delivery Understand the importance of DTDs Understand.
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.
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.
E0262 – MIS – Multimedia Storage Techniques XML (Extensible Markup Language)  XML is a markup language for creating documents containing structured information.
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.
XP 1 DECLARING A DTD A DTD can be used to: –Ensure all required elements are present in the document –Prevent undefined elements from being used –Enforce.
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.
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.
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
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.
XML Extensible Markup Language Aleksandar Bogdanovski Programing Enviroment LABoratory
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.
XML 2 Prepared by / Nael Alian Uinverity of Palestine Re. 1.
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.
Appendix C: Brief Overview of XML. ©SoftMoore ConsultingSlide 2 What is XML? The eXtensible Markup Language (XML) is a meta-markup language; i.e., a language.
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.
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.
Document Type Definitions (DTD) A Document Type Definition (DTD) defines the structure and the legal elements and attributes of an XML document. A DTD.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
Unit 10 Schema Data Processing. Key Concepts XML fundamentals XML document format Document declaration XML elements and attributes Parsing Reserved characters.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
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 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.
DTDs© Aptech Limited DTDs 03. DTDs© Aptech LimitedDTDs© Aptech Limited Document Type Definition  In this first lesson, Document Type Definition, you.
XP 1Creating Web Pages with XML Tutorial 1 New Perspectives on XML Tutorial 1 – Creating an XML Document.
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.
WELL- FORMEDNESS CH 6. Objective Well-formedness rules Text in XML Elements and Tags in Atributes Entity references CDATA sections Comments Unicode XML1.1.
HTML is about making documents. Simple Code for Simple Layout My Document This is an example HTML document First paragraph Second paragraph This is the.
XML intro. 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.
Extensible Markup Language XML
The XML Language.
Review of XML IST 421 Spring 2004 Lecture 5.
XML IST 421.
Presentation transcript:

225 City Avenue, Suite 106 Bala Cynwyd, PA , phone , fax presents… XML Syntax v2.0

2 Learning Objectives  The Markup Syntax – In general  Naming convention  The structure of an XML document  XML Elements  Nesting of XML Elements  Attributes and String Literals  Character and Entity References  Processing Instructions  CDATA sections  Comments

3 Markup Syntax – In General  The structure of a XML document is similar to an HTML document  XML markup uses angled-brackets to delimit tags (<>) just like HTML  Unlike HTML tags, XML tags are case-sensitive  In XML,,, are not equal

4 Naming Convention  XML names must begin with an underscore, colon or a letter and are followed with name characters  Name characters include the underscore, colon, letter, plus digits, hyphen and periods  Names cannot begin with the string “xml” in any case variation  Names beginning with “xml” are strictly for use by W3C

5 Naming Convention (con't)  The following are legal names in XML Employee employee _employee Employees:empid  The following are not legal names in XML XmlEmployee 124Empid -employee Empidsalary$ These two are not equivalent in XML

6 The Structure of an XML Document  An XML document consist of three parts An optional prolog The body consisting of the elements in a tree like structure An optional epilog containing comments, Processing Instructions (PIs) and/or white spaces

7 The Structure of an XML Document (con't) mk124 Amy Jones $80000 mk125 Cathy Smith $90000 BODY EPILOG PROLOG

8 The Structure of an XML Document (con't)  The “Prolog” is the starting point of an XML document  The “Prolog” Describes the character encoding method Provides configuration information to the parser  The “Prolog” consists of Optional XML Declaration Optional Document Type Declaration Optional PIs, white space characters, comments

9  XML Declaration: This is the basic syntax of an XML declaration  If an XML declaration is specified, it should be the first character in the XML document  This is the complete syntax of the XML declaration The Structure of an XML Document (con't)

10 The Structure of an XML Document (con't)  Document Type Declaration: Document Type Declaration is a way to associate a DTD (Document Type Definition) to a XML document (Document Type Declaration and Document Type Definition are different terms)  All “valid” XML documents must include this declaration

11 The Structure of an XML Document (con't)  The “Epilog” in an XML document may contain comments and PIs  The “Epilog” is not commonly declared in an XML document. It is advisable not to use it

12 The Structure of an XML Document (con't) An XML document hierarchical tree structure Document Root / Document Entity Document Element / Parent Element Elements

13 mk124 Amy Jones $80000 mk125 Cathy Smith $90000 The Structure of an XML Document (con't) Document Root Document Element Child Elements

14 XML Elements  Elements are the building blocks of an XML document  Elements may contain other elements, character data, PIs, comments or entity references  Elements consist of the element type name enclosed within angle brackets  Every element must contain a start-tag and an end- tag with the exception of empty-tags

15 XML Elements (con't)  Here are some legal start-tags  Here are some legal end-tags

16 XML Elements (con't)  This is a complete element with the start-tag and end-tag This is example to demonstrate elements and tags

17  Empty elements do not contain any content  Empty elements may consist of the start-tag and end-tag or be represented by a hybrid form  This is how we can represent empty elements XML Elements (con't)

18 XML Elements (con't)  Elements can have any of the four kinds of content Element type containing other elements with no character data is said to have element content Element type containing both character data and elements is said to have mixed content Element type containing only character data is considered character data Element type containing no content is an empty element. Empty elements may however contain attributes

19 Nesting of XML Elements  XML elements must be properly nested  Unlike HTML, XML does not permit improper nesting  If elements are not properly nested, a hierarchical tree cannot be constructed in XML  The XML parser will report any improper nesting in the XML document

20 Attributes and String Literals  Sometimes it is necessary to attach additional information about an element which may not be contained in the element itself  Attributes can be used for such situations  An attribute is a name value pair attached to the element

21  Any of the two formats can be used for attributes attributename = “attributevalue” attributename = ‘attributevalue’  The rules of string literals are applicable on attribute values  Start-tags and empty-elements can contain attributes Attributes and String Literals (con't)

22 Attributes and String Literals (con't) mk124 Amy Jones $80000 mk125 Cathy Smith $90000 Attribute Name and Attribute Value

23 Attributes and String Literals (con't)  String Literals are used as Values of attributes Internal entities External identifiers  String Literals are enclosed in delimiters  An apostrophe (‘) or double quotes (“) can be used as delimiters  Apostrophe or double quotes can be used within the string literal itself with some restrictions

24  If an apostrophe (‘) appears in the string literal, double quotes can used as a delimiter and vice versa  If both delimiters must appear within the string literal, they have to be appropriately escaped, using entity references - &apos; and "  Here are some valid string literals “value” ‘value’ ‘Remember, XML&apos;s “case-sensitivity” issue’ Attributes and String Literals (con't)

25  Here are some invalid string literals ‘value” “value’ ‘Remember, XML’s “case-sensitivity” issue’ Attributes and String Literals (con't)

26 Character and Entity References  XML provides two methods of representing characters that are not found in the ASCII character set  These two methods are: Character references Entity references

27 Character and Entity References (con't)  Character references are used as a substitute for a literal form of a character where the processing of the literal form will produce a non-well formed XML document  Character references are comprised of a decimal or hexadecimal number which is prefixed by “&#” (decimal) or “&#x” (hexadecimal) string literals and is followed by a semi-colon (;)

28 Character and Entity References (con't)  &#NN; represents the decimal equivalent to any Unicode character value in XML  &#xNN; represents the hexadecimal equivalent to any Unicode character value in XML - NN is a one or more digit that corresponds to a Unicode character value in XML  The hexadecimal form is preferred in XML

29  For example: The ampersand (&) in the word “L&T” could be represented in the following manner in XML L&T L&T  Decimal 38 and hexadecimal 26 represent the Unicode value for ampersand (&)  The decimal value has been prefixed with &# and the hexadecimal value has been prefixed with &#x Character and Entity References (con't)

30 Character and Entity References (con't)  To understand “Entity References”, first we will define an “Entity”  An “Entity” is a named body of data/content  “Entity Reference” is a placeholder to display that data or in other words, the entity  The entity is represented by the name prefixed with an ampersand (&) and followed by a semi-colon (;)

31 Character and Entity References (con't)  This is how an entity reference in displayed &entityname;  XML has five predefined entities & < > &apos; "  These five entities are used as escape sequences for the XML delimiter characters

32  Here is example of a predefined XML entity L&T  Except for the predefined entities, all entities must be defined prior to using them  An XML parser reports an error if it finds an undefined entity reference  Entities are defined in a DTD Character and Entity References (con't)

33 Character and Entity References (con't)  This is how we declare an entity within an XML document <!DOCTYPE root [ <!ENTITY example-info “This is just an example to show how an entity is declared"> ]> &example-info;

34  In a browser, this is how the entity will be displayed This is just an example to show how an entity is declared  Entity references may also be used as general text macros as above Character and Entity References (con't)

35 <!DOCTYPE root [ ]> &LQInfo; Do You Think This Will Work?

36 Processing Instructions  XML is designed for describing data. The presentation of the XML document is dependent on the application  But there are times when it is required to pass this information to an application along with the XML document  Processing Instruction (PI) is the mechanism to achieve this in an XML document

37  A CDATA Section is a section within the element content/data which is meant to be interpreted as character data and not markup by the parser  The basic syntax of a CDATA section is  A CDATA section begins with <![CDATA[  A CDATA section ends with the first occurrence of ]]> CDATA Sections

38  Consider this example: LearnQuest  All text within the start tag and end tag is considered as text and not markup. If you write it like this, LearnQuest ]]> The code will be interpreted as <start_tag>LearnQuest</end-tag> or <start_tag>LearnQuest</end-tag> CDATA Sections (con't)

39 CDATA Sections (con't)  CDATA sections are used when the author of the XML document wants to write XML code within the text or XML content  A CDATA section cannot contain the string “]]>”. Therefore a CDATA section cannot appear within a CDATA section

40 Comments  The basic syntax of an XML comment is:  where “Your comment goes here” can be any character string which does not include “- -”  The comment cannot end with a hyphen (-). The hyphen is a part of the closing delimiter and hence could be misinterpreted

41 Comments (con't)  Here are some examples displaying comments: <!- - A comment can also continue.. on another line - - >

42 Comments (con't)  Some illegal comments: This is not a legal way to comment because comments cannot appear within tags >

43 Any Questions?