OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: XML Schemas: Best Practices

[ Lists Home | Date Index | Thread Index ]
  • From: "Roger L. Costello" <costello@mitre.org>
  • To: xml-dev@lists.xml.org, "Pulvermacher,Mary K." <pulver@mitre.org>
  • Date: Sun, 01 Oct 2000 19:00:34 -0400

Hi Folks,

[Please see http://www.xfront.com/ExposingNamespaces.html for an online
version of the below discussion, along with hyperlinks to the other
discussions on this topic/]

A couple of weeks ago Len Bullard and Curt Arnold made some excellent
comments supporting the design practice of making explicit namespaces in
an instance document (as opposed to hiding/localizing the namespace
complexities in the schema).  I will attempt to summarize their points
here [Len, Curt please correct/add where I am negligent]:

Guidelines on when it is Beneficial to Expose the Namespaces in Instance
Documents (stated differently, Guidelines on when to Design your Schema
wherein Namespace Knowledge is Transferred to Instance Documents)

[1] Make Namespaces Explicit for Copyright Ownership Purposes: in the
Camera example that we have been using we created a schema which
imported elements from the Nikon, Olympus, and Pentex schemas.  I can
easily imagine that, for example, the Nikon Corporation would like for
other schemas to make use of its schema, but would want its elements
clearly identified (e.g., nikon:body) in instance documents. 

[2] Make Namespaces Explicit to Distinguish Elements with Identical
Names but Different Semantics: suppose that we were to create a schema
for a book on cameras.  It is easy to imagine creating a chapter
element, and within it a body element (for the chapter body).  Within
the chapter body element it is easy to imagine having another body
element which represents the camera body.   In an instance document this
schema would appear as:

     <chapter>
          <body>
               <body>
                  …
               </body>
          </body>
     </chapter>

Without any namespace qualifiers this instance document could be
confusing.  In this example, namespace qualifiers can enhance the
instance document's readability:

     <chapter>
          <pub:body>
               <nikon:body>
                  …
               </nikon:body>
          </pub:body>
     </chapter>

So, where there are multiple elements with different semantics namespace
qualifiers can enhance readability and understandability of instance
documents.

[3] Make Namespaces Explicit to Show Lineage/Traceability/Ownership of
Elements: there are many times when you want to make explicit where an
element comes from (i.e., its lineage) - for traceability purposes, or
for identifying ownership.

Summary

Here is a brief summary of both sides of the hide versus expose
discussion. 

Hide/Localize Namespaces in the Schema when:

- Namespaces in the instance provide no necessary additional
information.  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.

Expose Namespaces in the Schema when:

- Lineage/Ownership of the elements are important to the instance
document users. 
- It is necessary to distinguish elements with the same name but
different semantics.

/Roger





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS