XML Technologies and Related Applications

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

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.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
 Fundamentals of Web Design.  Describe the history and theory of XHTML  Understand the rules for creating valid XHTML documents  Apply a DTD to an.
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.
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.
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Tutorial 11 Creating XML Document
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
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.
XP New Perspectives on XML Tutorial 3 1 DTD Tutorial – Carey ISBN
Pemrograman Berbasis WEB XML part 2 -Aurelio Rahmadian- Sumber: w3cschools.com.
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.
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.
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.
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.
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.
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.
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.
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
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
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.
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.
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.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
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.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
Tutorial 9 Working with XHTML. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Describe the history and theory of XHTML.
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:
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
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.
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.
XML BASICS and more…. What is XML? In common:  XML is a standard, simple, self-describing way of encoding both text and data so that content can be processed.
Unit 4 Representing Web Data: XML
Creating a Well-Formed Valid Document
Tutorial 9 Working with XHTML
Extensible Markup Language XML
XML QUESTIONS AND ANSWERS
Extensible Markup Language XML
Chapter 7 Representing Web Data: XML
Chapter X IXXXXXXXXXXXXXXXX.
Creating an XML Document
Tutorial 9 Working with XHTML
Allyson Falkner Spokane County ISD
Review of XML IST 421 Spring 2004 Lecture 5.
Presentation transcript:

XML Technologies and Related Applications Lesson 2

Review XML is a technology for creating markup languages to describe data of virtually any type in a structured manner. Unlike HTML, which limits the document author to a fixed set of tags, XML allows document authors to describe data more precisely by creating new tags. XML can be used to create markup languages for describing data in almost any field.

Objectives • Learn about Elements and Attributes. • Learn how namespaces are used to promote better interoperability. • Use entity references to embed illegal characters. • Understand the importance of the prolog. • Add comments to your XML documents.

What Makes an XML Document? XML documents are based on elements. An element is comprised of a start tag, content, and an end tag. Elements can contain other elements, and additional descriptive information about an element can be encoded with attributes. <myMessage> <message>Welcome to XML!</message> </myMessage> white space is irrelevant!

Some notes Elements can contain other elements, nested to any arbitrary depth. (solar system.xml) Note that symmetry among elements is not required. Every element can have any combination of any sub-element name. XML documents are commonly stored in text files that end in the extension .xml, although this is not a requirement of XML.

Elements: The Building Blocks of XML

Valid element names • Must start with a letter A..Za..z or an underscore, • May contain any combination of A..Za..z, 0..9, dash ( - ), or underscore • Can be of any length. • Are case sensitive. • Terseness is of minimal importance.

Content Content is the text between opening and closing tags. In order to be able to tell the difference between tags and content, a small number of characters and symbos are not allowed in the content area.

Special Symbols(1) Common Symbols < < < > > > < < < > > > “ " " ‘ &apos; ' & & & #65 for Capital A

CDATA A better solution is to tag such content with the CDATA character data section modifier. This tells the parser to ignore the content and not attempt to interpret it as having XML markup. <customer> <name><![CDATA[ You & Me ]]></name> </customer> CDATA section can not have another nested CDATA section. CDATA Parse eg.xml

Root Element All XML documents must contain exactly one root element . A DOM tree.

Attributes: More Muscle for Elements(1) Sometimes you need to convey more information about an element than its name and content can express. An attribute can be used to give the element a unique label so it can be easily located, or it can describe a property about the element. An element can have any number of attributes, as long as each has a unique name.

Attributes: More Muscle for Elements(2) All-element design is superior. (Attribute)To see if the element is a simple scalar data value that has only a single interpretation and is not likely to change or expand over time.

About content Which is better? It’s up to you! Data and metadata. Text information between opening and closing tag-pairs is data. Tag names, attributes and their relationship are metadata.

Attributes: More Muscle for Elements(3) Attribute values can be constrained to certain types if you use a DTD. One type is ID, which tells XML that the value is a unique identifier code for the element. No two elements in a document can have the same ID. Another type, IDREF, is a reference to an ID.

Data type Everything in XML files will be interprets as strings. To enforce specific data type. DTD XML Schema Quotes in attributes.

Reserved Attribute Names Some attribute names have been set aside for special purposes by the XML working group. These attributes are reserved for XML's use and begin with the prefix xml: xml:lang xml:space xml:link xml:attribute

XML Documents Parsers (1) A software program called an XML parser (or an XML processor) is required to process an XML document. The XML parser reads the XML document, checks its syntax, reports any errors and allows programmatic access to the document's contents. An XML document is considered well formed if it is syntactically correct.

XML Documents Parsers (2) Most XML parsers can be downloaded at no charge. Such as Microsoft Internet Explorer 5 (IE5), have built-in XML parsers, the Apache XML Project's parser Xerces, Sun Microsystem's Java API for XML Parsing (JAXP) and IBM's parser XML for Java (XML4J).

Basic Document Structure Rules 1. Tags are case-sensitive. 2. Opening tags must have closing tags. 3. Tags must be properly nested. 4. Attribute values require quotes. 5. Root Element required. well-formed XML document

Some Examples

The Document Prolog The top of an XML document is graced with special information called the document prolog. But the prolog can hold additional information that nails down such details as the document type definition being used, declarations of special pieces of text, the text encoding, and instructions to XML processors.

XML declaration(1) version: Sets the version number. encoding: Defines the character encoding used in the document, such as US-ASCII. standalone: Tells the XML processor whether there are any other files to load.

XML declaration(2) All of the properties are optional, but you should try to include at least the version number in case something changes drastically in a future revision of the XML specification. The parameter names must be lowercase, and all values must be quoted with either double or single quotes.

Document type declaration This is where you can specify various parameters such as entity declarations, the DTD to use for validating the document, and the name of the root element.

PI(1) It is a container for data that is targeted toward a specific XML processor. Processing instructions (PIs) contain two pieces of information: a target keyword and some data.

PI(2) The PI can contain any data except the combination ?>, which would be interpreted as the closing delimiter. <?xml-stylesheet href=“style.css” type=“text/css”> <?xml-stylesheet href=“style.xsl” type=“text/xsl”>

Comments (1) Comments are notes in the document that are not interpreted by the parser. They can be used to identify the purpose of files and sections to help navigate a cluttered document, or simply to communicate with each other.

Comments (2) Two dashes in a row (--) are used tell the parser when a comment begins and ends, they can't be placed anywhere inside the comment. Since comments can contain markup, they can be used to "turn off" parts of a document. Don't put comments inside comments or elements.

Something about UTF-8 Unicode (2 bytes) UCS (Universal Character Set) 216=65536 UCS (Universal Character Set) UCS-2 UCS-4 UTF (Unicode/UCS Transformation Format) UTF-8 UTF-16

XML 1.0 V.S. XML 1.1 Unicode compatibility. Backward and forward compatibility.

Namespaces: Expanding Vocabulary(1) What happens when you want to include elements or attributes from different document types?

Namespaces: Expanding Vocabulary(2) A namespace must be declared in the document before you can use it. Be careful not to use prefixes like xml, xsl, or other names reserved by XML and related languages. The XML processor isn't required to do anything with the URI, however.

uri url... URI(Uniform Resource Identifier) RFC 2396 URL(Uniform Resource Locator) URN(Uniform Resource Name)

Scope of NS

Default namespace We can declare one of the namespaces to be the default by omitting the colon (:) and the name from the xmlns attribute. Elements and attributes in the default namespace don't need the namespace prefix, resulting in clearer markup.

Some problems about NS Namespaces can be a headache if used in conjunction with a DTD. Namespaces can only assure that names are unique and unambiguous. They have nothing to do with document validity. The URI referenced in a namespace declaration does nothing more than provide an identifier to the processing application. In fact, most XML parsers completely and utterly ignore the namespace URI.

Summary You can read and write arbitrarily complex XML documents by using the simple element and attribute markups. It is simple to create well-formed XML document by hand. Know the grammar rules regarding what’s acceptable for element and attribute names. Understand the importance of designing with elements versus attributes, and when to use which one. Namespaces are a powerful feature of XML.