1 Hide (Localize) Namespaces versus Expose Namespaces XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions.

Slides:



Advertisements
Similar presentations
Registry breakout group DC-8, National Library of Canada 5 October 2000.
Advertisements

OLAC Metadata Steven Bird University of Melbourne / University of Pennsylvania OLAC Workshop 10 December 2002.
Technical Committee on GJXDM Technical Committee Presentation on GJXDM.
XML Schema Heewon Lee. Contents 1. Introduction 2. Concepts 3. Example 4. Conclusion.
Copyright © [2002]. Roger L. Costello. All Rights Reserved. 1 XML Schemas Reference Manual Roger L. Costello XML Technologies Course.
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.
Ümit Yalçınalp David Burdett Gunther Stuhec NetWeaver Platform EcoSystem Group, SAP Labs XML Schema User Experience Report.
The Semantic Web – WEEK 4: RDF
4 XML Schema.
XML 6.5 XML Schema (XSD) 6. What is XML Schema? The origin of schema  XML Schema documents are used to define and validate the content and structure.
XML Flattened The lessons to be learned from XBRL.
Copyright © Open Applications Group, Inc. All rights reserved 1 OAGi XML Schema User Report June 21, Michael.
Application of XML Schema in Web Services Security Sridhar Guthula W3C XML Schema 1.0 User Experiences
1 Implementing Variable Content Containers XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev.
JAXB Java Architecture for XML Bindings. What is JAXB? JAXB defines the behavior of a standard set of tools and interfaces that automatically generate.
IRS XML Standards & Tax Return Data Strategy For External Discussion June 30, 2010.
Copyright (c) [2001]. Roger L. Costello. All Rights Reserved. 1 … more on XML Schemas Roger L. Costello XML Technologies Course.
Unit 4 – XML Schema XML - Level I Basic.
Jennifer Widom XML Data XML Schema. Jennifer Widom XML Schema “Valid” XML Adheres to basic structural requirements  Also adheres to content-specific.
ACG 4401 XML Schemas XML Namespaces XLink. + The XML Foundation Many participants – an extended family! XML Instance documents – carry data in context.
ACG 4401 XML Schemas XML Namespaces XMLink. + The XML Foundation Many participants – an extended family! XML Instance documents – carry data in context.
Module 17 Storing XML Data in SQL Server® 2008 R2.
12 December, 2012 Katrin Heinze, Bundesbank CEN/WS XBRL CWA1: European Filing Rules CWA1Page 1.
XP New Perspectives on XML Tutorial 4 1 XML Schema Tutorial – Carey ISBN Working with Namespaces and Schemas.
1 Multi-Schema Project: Zero, One, or Many Namespaces? XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
Creating Extensible Content Models XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev.
XML eXtensible Markup Language w3c standard Why? Store and transport data Easy data exchange Create more languages WSDL (Web Service Description Language)
Federal XML Naming and Design Rules and Guidelines Paul Macias.
Federal XML Naming and Design Rules and Guidelines Paul Macias.
UN/CEFACT Forum Wednesday, 16 March 2005 Lunch & Learn ATG XML NDR Mark Crawford ATG2 Chair U NITED N ATIONS C ENTRE F OR T RADE F ACILITATION A ND E LECTRONIC.
1 Roger L. Costello, David B. Jacobs. © 2003 The MITRE Corporation. A Quick Introduction to OWL Web Ontology Language Roger L. Costello David B. Jacobs.
CSE3201 XML Namespace. 2 What is a namespace? An XML namespace is a collection of element type and attribute names.
ISURF -An Interoperability Service Utility for Collaborative Supply Chain Planning across Multiple Domains Prof. Dr. Asuman Dogac METU-SRDC Turkey METU.
Default Namespace - targetNamespace or XMLSchema? XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev.
Federal XML Naming and Design Rules and Guidelines Mark Crawford.
Beginning XML 4th Edition. Chapter 5: XML Schemas.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
New Perspectives on XML, 2nd Edition
Web 310 XML Schema : What You Need to Know and Why Yasser Shohoud Program Manager XML Messaging Microsoft Corporation.
ACG 4401 XML Schemas XML Namespaces XLink. + The XML Foundation Many participants – an extended family! XML Instance documents – carry data in context.
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
XML-NDM Schema Issues (From Service Management Perspective) 18 September 2012.
Processing of structured documents Spring 2003, Part 3 Helena Ahonen-Myka.
COSC617 Project XML Tools Mark Liu Sanjay Srivastava Junping Zhang.
Introduction to Classes and Objects. Real Life When a design engineer needs an electrical motor he doesn’t need to worry about –How a foundry will cast.
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.
When we create.rtf document apart from saving the actual info the tool saves additional info like start of a paragraph, bold, size of the font.. Etc. This.
XSD: XML Schema Language Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XML Schema Definition (XSD). Definition of a Schema It is a model for describing the structure and content of data The XML Schema was developed as a content.
September 6, GJXDM Users Conference NCIC Schema Challenges Patrice A. Yuh
Discussion on XSD implementation conventions (document number PRO R01) Group Name: PRO Source: Wolfgang Granzow, Meeting.
METS from scratch Jerome McDonough New York University October 21, 2003.
1 Global versus Local XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev.
ACG 6415 XML Schemas XML Namespaces XMLink. The XML Foundation  Many participants – an extended family! XML documents – carry data in context  Each.
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.
4 Copyright © 2004, Oracle. All rights reserved. Validating XML by Using XML Schema.
1 XML and XML in DLESE Katy Ginger November 2003.
The Purpose of XML Namespaces
CWA3 Standardized roll-out package Part 2: XBRL Handbook for Declarers
Flexible Extensible Digital Object Repository Architecture
Grid Metadata Management
XML Schemas for Dublin Core Metadata
Flexible Extensible Digital Object Repository Architecture
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
NIEM Tool Strategy Next Steps for Movement
Views Base Relation View
New Perspectives on XML
Presentation transcript:

1 Hide (Localize) Namespaces versus Expose Namespaces XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev

2 <xsd:schema … targetNamespace=“A”> A.xsd <xsd:schema … targetNamespace=“B”> B.xsd <xsd:schema … targetNamespace="C"> <xsd:import namespace="A" schemaLocation="A.xsd"/> <xsd:import namespace="B" schemaLocation="B.xsd"/> … C.xsd Typical Scenario: Multiple Schemas, each with a Different Namespace

3 Hide (Localize) Namespaces The namespaces of the components are not visible in the instance documents. <myDoc … schemaLocation=“C C.xsd”> Instance Document

4 Expose Namespaces <myDoc … schemaLocation=“C C.xsd”> The namespaces of the components are visible in the instance documents. Instance Document

5 Hide (Localize) Namespaces The namespaces of the elements used in an instance document are hidden within the schema. –That is, the namespace complexities are localized to the schemas. The complexities are not propagated to instance documents.

6 Expose Namespaces The namespaces of the elements used in an instance document are made visible in instance documents.

7 elementFormDefault - the Exposure “Switch” hide expose elementFormDefault <xsd:schema … elementFormDefault=“qualified”> <xsd:schema … elementFormDefault=“unqualified”> vs Schema

8 How do we Design the below Schemas to Hide (Localize) Namespaces? versus How do we Design them to Expose Namespaces? Camera.xsd Nikon.xsd Olympus.xsd Pentax.xsd

9 <xsd:schema xmlns:xsd=" targetNamespace=" xmlns:nikon=" xmlns:olympus=" xmlns:pentax=" elementFormDefault="unqualified"> <xsd:import namespace=" schemaLocation="Nikon.xsd"/> <xsd:import namespace=" schemaLocation="Olympus.xsd"/> <xsd:import namespace=" schemaLocation="Pentax.xsd"/> <xsd:element name="manual_adapter" type="pentax:manual_adapter_type"/> This schema is designed to hide namespaces

10 <my:camera xmlns:my=" xmlns:xsi=" xsi:schemaLocation= " Camera.xsd"> Ergonomically designed casing for easy handling</descriptio 300mm 1.2 1/10,000 sec to 100 sec Instance document with namespaces hidden (localized) within the schema Ergonomically designed casing for easy handling 300mm 1.2 1/10,000 sec to 100 sec Instance document with namespaces hidden (localized) in the schema. --> The fact that the element comes from the Nikon schema, the and elements come from the Olympus schema, and the element comes from the Pentax schema is totally transparent to the instance document. Instance Document

11 Technical Requirements for Hiding (Localizing) Namespaces The schema must be designed as follows: –elementFormDefault must be set to unqualified –The elements whose namespaces are to be localized to the schema must be declared locally (recall that global elements must always be qualified) elementFormDefault only behaves as a “switch” when this requirement is met!

12 <xsd:schema xmlns:xsd=" targetNamespace=" xmlns:nikon=" xmlns:olympus=" xmlns:pentax=" elementFormDefault="qualified"> <xsd:import namespace=" schemaLocation="Nikon.xsd"/> <xsd:import namespace=" schemaLocation="Olympus.xsd"/> <xsd:import namespace=" schemaLocation="Pentax.xsd"/> <xsd:element name="manual_adapter" type="pentax:manual_adapter_type"/> This schema is designed to expose namespaces

13 <c:camera xmlns:c=" xmlns:nikon=" xmlns:olympus=" xmlns:pentax=" xmlns:xsi=" xsi:schemaLocation= " Camera.xsd> Ergonomically designed casing for easy handling 300mm 1.2 1/10,000 sec to 100 sec Instance document with namespaces exposed Ergonomically designed casing for easy handling 300mm 1.2 1/10,000 sec to 100 sec Instance Document

14 Technical Requirements for either Hiding or Exposing Namespaces elementFormDefault applies just to the schema that it is in. It does not apply to schemas that it includes or imports. Consequently, if you want to hide namespaces then all schemas involved must have set elementFormDefault="unqualified". Likewise, if you want to expose namespaces then all schemas involved must have set elementFormDefault="qualified". The next couple of slides shows what happens when a mix of elementFormDefault values is used.

15 Nikon.xsd elementFormDefault="qualified" Olympus.xsd elementFormDefault="unqualified" Pentax.xsd elementFormDefault="qualified" Camera.xsd elementFormDefault="unqualified"

16 Hiding/exposure mix: This instance document has the Nikon and Pentax namespaces exposed, while the Camera and Olympus namespaces are hidden. Instance Document <my:camera xmlns:my=" xmlns:nikon=" xmlns:pentax=" xmlns:xsi=" xsi:schemaLocation= " Camera.xsd> Ergonomically designed casing for easy handling 300mm 1.2 1/10,000 sec to 100 sec 300mm 1.2 Instance document with namespaces hidden (localized) within the schema Ergonomically designed casing for easy handling 300mm 1.2 1/10,000 sec to 100 sec Ergonomically designed casing for easy handling 1/10,000 sec to 100 sec

17 Guidelines: When to Hide (Localize) Namespaces within the Schema When simplicity, readability, and understandability of instance documents is of utmost importance. In many scenarios the users of the instance documents are not XML-experts. Namespaces would distract and confuse such users, where they are just concerned about structure and content. When namespaces in the instance provide no necessary additional information. When you need the flexibility of being able to change the inner components without impact to instance documents –Example. Changing from using the Olympus schema to declare the and elements to another vendor’s schema is transparent

18 Guidelines: When to Expose Namespaces in Instance Documents When lineage (ownership) of the elements are important, e.g., for copyright purposes When there are multiple elements with the same name then it may be necessary to qualify those elements to make clear their semantics. –Example. versus When processing (by an application) of the instance document elements is dependent upon knowledge of the namespaces of the elements –Forcing applications to go to the schema for such information may be costly in terms of speed. This cost may be negated as XML API’s (DOM, SAX) provide namespace information for each element.

19 Best Practice Make two versions of all your schemas - one with elementFormDefault="qualified" and the other with elementFormDefault="unqualified". –If every schema designer adopts this practice then each schema designer will be able to make a choice on whether to hide or expose namespaces. Minimize the use of global elements and attributes so that elementFormDefault may be used as an “exposure switch”. Do Labs 1,2,3,4