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

Introduction to the Logical Structure of XML Documents Web Engineering, SS 2007 Tomáš Pitner, Michael Derntl.
Chapter 3: XML Namespaces. Chapter 3 Objectives Why you need namespaces What namespaces are, conceptually and how they solve the problem of naming clashes.
XML: text format Dr Andy Evans. Text-based data formats As data space has become cheaper, people have moved away from binary data formats. Text easier.
17 Apr 2002 XML Namespaces Andy Clark. The Problem Documents use different vocabularies – Example 1: CD music collection – Example 2: online order transaction.
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.
XML Name spaces. Different people may invent similar tag names Here is an XML element describing a piece of furniture: table99 dining table Here.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
XHTML1 Building Document Structure. XHTML2 Objectives In this chapter, you will: Learn how to create Extensible Hypertext Markup Language (XHTML) documents.
XML Namespaces Andrey Smirnov CSCI 7818 September 21, 2000.
XP New Perspectives on XML, 2nd Edition Tutorial 2 1 TUTORIAL 2 WORKING WITH NAMESPACES.
HTML Elements. HTML documents are defined by HTML elements.
Tutorial 2: XML Working with Namespaces. COMBINING XML VOCABULARIES IN A COMPOUND DOCUMENT Section 2.1.
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.
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.
Skip 2007 Current Issues in MIS The XML Language Foundation f - Clinton E. White, Jr Professor of Accounting & MIS Lerner College of B&E University.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
CSE3201 XML Namespace. 2 What is a namespace? An XML namespace is a collection of element type and attribute names.
1 Dr Alexiei Dingli XML Technologies XML Advanced.
1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006.
XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.
New Perspectives on XML, 2nd Edition
XP New Perspectives on XML, 2nd Edition Tutorial 2 1 TUTORIAL 2 WORKING WITH NAMESPACES.
Accessing Data Using XML CHAPTER NINE Matakuliah: T0063 – Pemrograman Visual Tahun: 2009.
1 Credits Prepared by: Rajendra P. Srivastava Ernst & Young Professor University of Kansas Sponsored by: Ernst & Young, LLP (August 2005) XBRL Module Part.
Advanced Accounting Information Systems Day 31 XML Language Foundation November 6, 2009.
XML Basics A brief introduction to XML in general 1XML Basics.
XSD Presented by Kushan Athukorala. 2 Agenda XML Namespaces XML Schema XSD Indicators XSD Data Types XSD Schema References.
XML 2nd EDITION Tutorial 4 Working With Schemas. XP Schemas A schema is an XML document that defines the content and structure of one or more XML documents.
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.
3 XML Namespaces XML Namespaces Order No Dear Dr. Smith, we confirm your order of the book 1The XML Handbook ISBN: Price: USD.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
Working with XML Schemas ©NIITeXtensible Markup Language/Lesson 3/Slide 1 of 36 Objectives In this lesson, you will learn to: * Declare attributes in an.
1 Compound Documents: Combining XML Vocabularies.
Tutorial 2: XML Working with Namespaces. 2 Name Collision This figure shows two documents each with a Name element.
Introduction to XML Namespaces Web Engineering, SS 2007 Tomáš Pitner.
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
Web Services. XML Namespaces, Schemas XML processing. Week 2.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
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.
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.
Beginning XML 4th Edition. Chapter 3: XML Namespaces.
The Purpose of XML Namespaces
Unit 4 Representing Web Data: XML
CIS 228 The Internet 9/20/11 XHTML 1.0.
Tutorial 9 Working with XHTML
Tutorial 9 Working with XHTML
WORKING WITH NAMESPACES
XML QUESTIONS AND ANSWERS
WSDL Using <import>
Chapter 7 Representing Web Data: XML
Tutorial 9 Working with XHTML
Namespace Review 21-Nov-18.
XML Example Database systems Hector Garcia-Molina $100
Namespace Review 29-Dec-18.
Javascript & jQuery XML.
CMP 051 XML Introduction Session IV Chapter 12 – XML Namespaces
Working with Namespaces and Schemas
CMP 051 XML Introduction Session IV Chapter 12 – XML Namespaces
Namespace Review 14-Oct-19.
New Perspectives on XML
Presentation transcript:

Namespaces

Purpose Namespaces were added late to the XML specification They serve two purposes To distinguish between elements and attributes of different vocabularies To group all related elements and attributes from an XML application so a software application can easily recognize them

Namespace Functions c:address c:customerid e:dept e:salary e:hiredate xmlns:e=“http://employee” xmlns:c=”http://customer” c:address c:customerid e:name c:name c:phone e:phone e:dept e:salary e:hiredate Group related objects Distinguish vocabularies

Default Namespace You can use the xmlns attribute to declare a default namespace <elementname xmlns=“URI”> The URI (universal Resource Identifier) can be a name or address that identifies a resource. Typically the URI is a web address, however this address does not need to point to any actual document

Default Namespace Example <?xml version=“1.0” encoding=“UTF-8” ?> <employees xmlns=“http://seattlecentral.org/faculty/sconge/employees.xsd”> . . . </employees>

Namespaces with Prefixes You can assign a prefix to a namespace <emp:employees xmlns:emp=“http://seattlecentral.org/facutly/sconge/employees.xsd”> <emp:employee> <emp:firstname>Alice</emp:firstname> . . . </emp:employee> </emp:employees>

Using Multiple Namespaces A single XML document can contain multiple namespaces You can nest default namespaces or differentiate them by prefixes

Nesting Namespaces <employees xmlns=“http://seattlecentral.org/facutly/sconge/employee.xsd”> <employee> <firstname>Alice</firstname> <lastname>Smith</lastname> <payroll xmlns=“http://seattlecentral.org/faculty/sconge/payroll.xsd”> <status>Full time</status> <paytype>Salary</paytype> <paystep>5</paystep> </payroll> <dept>IT</dept> </employee> </employees>

Attributes The default namespace does not include the attributes Attributes can include a namespace prefix By default the attribute belongs to the element’s private namespace

Namespaces Best Practices Use the default namespace on the root element Use one default namespace at most Declare prefixed namespaces as soon as possible Do not use the same prefix for different name spaces Use one prefix for each namespace