Beginning XML 4th Edition. Chapter 3: XML Namespaces.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 5-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Advertisements

Transforming XML XMLNamespaces, XSLT. XML Namespaces Sometimes it is necessary to mix XML elements –Different types of content –Use of markup to convey.
XML Schema Heewon Lee. Contents 1. Introduction 2. Concepts 3. Example 4. Conclusion.
Chapter 3: XML Namespaces. Chapter 3 Objectives Why you need namespaces What namespaces are, conceptually and how they solve the problem of naming clashes.
17 Apr 2002 XML Namespaces Andy Clark. The Problem Documents use different vocabularies – Example 1: CD music collection – Example 2: online order transaction.
XML Namespaces Each schema file associated with a URL to uniquely identify where elements come from – Like packages in Java
1 RDF Tutorial. C. Abela RDF Tutorial2 What is RDF? RDF stands for Resource Description Framework It is used for describing resources on the web Makes.
XML Namespaces Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
 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 Name spaces. Different people may invent similar tag names Here is an XML element describing a piece of furniture: table99 dining table Here.
Tutorial 9 Working with XHTML
XHTML1 Building Document Structure. XHTML2 Objectives In this chapter, you will: Learn how to create Extensible Hypertext Markup Language (XHTML) documents.
Namespace in XML Transparency No. 1 Namespace in XML Cheng-Chia Chen.
Grid Computing, B. Wilkinson, 20043a.1 WEB SERVICES Introduction.
XML Namespaces Andrey Smirnov CSCI 7818 September 21, 2000.
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.
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
XP New Perspectives on XML, 2nd Edition Tutorial 2 1 TUTORIAL 2 WORKING WITH NAMESPACES.
Unit 4 – XML Schema XML - Level I Basic.
Introduction to XML This material is based heavily on the tutorial by the same name at
Tutorial 2: XML Working with Namespaces. COMBINING XML VOCABULARIES IN A COMPOUND DOCUMENT Section 2.1.
1 understanding xml namespaces. 2 understanding namespaces Namespaces are the source of much confusion in XML, especially for those new to the technology.
Working with Namespaces Combining XML Vocabularies in a Compound Document.
XML 2nd EDITION Tutorial 2 Working With Namespaces.
WORKING WITH NAMESPACES
XP New Perspectives on XML Tutorial 4 1 XML Schema Tutorial – Carey ISBN Working with Namespaces and Schemas.
Working with XHTML Creating a Well-Formed Valid Document.
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.
XP The University of Akron Summit College Business Technology Department Computer Information Systems 2440: 140 Internet Tools Instructor: Enoch E. Damson.
1 COS 425: Database and Information Management Systems XML and information exchange continued Last time: XML document structure XML querying with XQuery.
Chapter 4: Document Type Definitions. Chapter 4 Objectives Learn to create DTDs Validate an XML document against a DTD Use DTDs to create XML documents.
Session IV Chapter 9 – XML Schemas
Processing of structured documents Spring 2002, Part 2 Helena Ahonen-Myka.
1 Dr Alexiei Dingli XML Technologies XML Advanced.
Beginning XML 4th Edition. Chapter 5: XML Schemas.
CIS 451: XML DTDs Dr. Ralph D. Westfall February, 2009.
XP New Perspectives on XML, 2nd Edition Tutorial 2 1 TUTORIAL 2 WORKING WITH NAMESPACES.
XML Basics A brief introduction to XML in general 1XML Basics.
1 Tutorial 14 Validating Documents with Schemas Exploring the XML Schema Vocabulary.
Tutorial 13 Validating Documents with Schemas
1 Tutorial 12 Working with Namespaces Combining XML Vocabularies in a Compound Document.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
Beginning XML 3 rd Edition. Chapter 4: Document Type Definitions.
XML Validation II Schemas Robin Burke ECT 360. Outline Namespaces Documents  Data types XML Schemas Elements Attributes Derived data types RELAX NG.
1 Compound Documents: Combining XML Vocabularies.
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
Tutorial 2: XML Working with Namespaces. 2 Name Collision This figure shows two documents each with a Name element.
XML Validation II Advanced DTDs + Schemas Robin Burke ECT 360.
Introduction to XML Namespaces Web Engineering, SS 2007 Tomáš Pitner.
Tutorial 9 Working with XHTML. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Describe the history and theory of XHTML.
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
PART 1 XML Basics. Slide 2 Why XML Here? You need to understand the basics of XML to do much with Android All of they layout and configuration files are.
This is a test Webpage Wow, I’m writing my first webpage.
XML Namespaces In this first lesson XML Namespaces, you will learn to:
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
CITA 330 Section 4 XML Schema. XML Schema (XSD) An alternative industry standard for defining XML dialects More expressive than DTD Using XML syntax Promoting.
Web Services: Principles & Technology Slide 3.1 Chapter 3 Brief Overview of XML COMP 4302/6302.
The Purpose of XML Namespaces
Creating a Well-Formed Valid Document
Tutorial 9 Working with XHTML
Tutorial 9 Working with XHTML
WORKING WITH NAMESPACES
Tutorial 9 Working with XHTML
Namespace Review 21-Nov-18.
Namespaces.
Namespace Review 29-Dec-18.
Namespace Review 14-Oct-19.
New Perspectives on XML
Presentation transcript:

Beginning XML 4th Edition

Chapter 3: XML Namespaces

Chapter 3 Objectives Why you need namespaces What namespaces are, conceptually and how they solve the problem of naming clashes The syntax for using namespaces in XML documents What is a URI, URL, and URN

Why Do We Need Namespaces? Sir John Fitzgerald Johansen Doe Vice President of Marketing Resume of John Doe John Doe John’s a great guy, you know?

Using Prefixes Sir John Fitzgerald Johansen Doe Vice President of Marketing Resume of John Doe John Doe John’s a great guy, you know?

So Why Doesn’t XML Just Use These Prefixes? Sir

How XML Namespaces Work Sir

Try It Out Adding XML Namespaces to Your Document

Default Namespaces Sir <person xmlns=“ xmlns:xhtml=“ This is XHTML Default except for the tag Default

Try It Out Default Namespaces in Action

Declaring Namespaces on Descendants Example 1 This is XHTML Example 2 This is XHTML

Try It Out Default Namespaces for Children

Canceling Default Namespaces Jane Doe I’ve worked with Jane Doe for over a year now.

Do Different Notations Make Any Difference? You can fully qualify every name, like this: <pers:person xmlns:pers=" xmlns:xhtml=" This is XHTML Or, you can use one namespace as the default, and just qualify any names from other namespaces, like this: <person xmlns=" xmlns:xhtml=" This is XHTML Or, you can just use defaults everywhere, like this: This is XHTML

Do Different Notations Make Any Difference?

Namespaces and Attributes Example 1 Sir Example 2 Sir

Namespaces and Attributes Do namespaces work the same for attributes as they do for elements?

Try It Out Adding Attributes

What Exactly Are URIs? ProtocolURI

URNs urn:foo:a123,456 Examples Social security numbers Serial numbers NIC mac addresses

Why Use URLs for Namespaces, Not URNs?

RDDL Resource Directory Description Language

When Should You Use Namespaces?

Remember that a namespace is just a “bag of names”—that is, it’s a group of element names that belong together, and that are distinct from element names in other namespaces. The key is the phrase belong together.

Exercise Questions Question 1 In this chapter you saw the following XML document, in which you had to cancel the default namespace: Jane Doe I’ve worked with Jane Doe for over a year now. Assuming that this document is for Wiley’s HR department, create a namespace for employees, and use it in this document. Be sure to keep the XHTML elements in their namespace.

Exercise Questions Question 2 Imagine that Wiley has been going through the employee records and realized that they don’t have a good unique way to identify each employee. Create a global id attribute that can be attached to any XML element in the employee namespace you created earlier. Put this attribute into effect by modifying the XML you created in Question 1, and marking the Jane Doe employee as employee number x125.

Exercise Questions Question 3 Create a new XML file for an employee named Alfred Neuman, with employee number x393. In the notes for Alfred mention that he has worked closely with Jane Doe, being sure to use the element to refer to her.

Try It Out Adding XML Namespaces to Your Document Default Namespaces in Action Default Namespaces for Children Adding Attributes