[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Namespace usage example

  • From: Ken MacLeod <ken@b...>
  • To: xml-dev@l...
  • Date: Sat, 30 Dec 2000 11:59:07 -0600

namespace usage
I've been working on a library recently that makes good use of
namespaces at the property-name level that I thought would make a good
data point in the conversation.  In particular, no semantics, schema
checking, or anything is inferred from the namespace, namespaces are
just used to distinguish properties defined by different sources.

I'm a grovist, so the first thing I did was move grove intrinsic
properties out of the node's regular property namespace and into their
own namespace:

  all nodes
  ------------
  intrinsic:class
  intrinsic:namespace-uri
  intrinsic:parent

'intrinsic:namespace-uri' is the default namespace for unqualified
property names on a node.  'intrinsic:class' is the grove property for
a node's type or class.

RDF Site Summary (RSS) 1.0 has been an excellent showcase for how this
works.  In addition to intrinsic and core RSS properties, RSS also
allows "modules" to add properties to channel and item nodes:

  Channel or Item
  ---------------
  title
  description
  dc:subject
  dc:author

Here, 'title' and 'description' are in the default namespace of the
node (as given in intrinsic:namespace-uri), and 'dc:subject' and
'dc:author' are from the Dublin Core RSS module.

Ideally, a language would allow namespace declarations and prefixes to
be used directly in the syntax of the language.  Some languages can
use a preprocessor to add those easily.  Python and Perl are using
(namespace-uri, localname) tuples as dictionary/hash keys.

  Ideal:   channel.dc:subject
  Python:  channel[(dc, 'subject')]
  Perl:    $channel->{[$dc, 'subject']}

Of course, it will likely to be common to just put those keys into a
class variable, like $channel->{$dc_subject} in Perl.

This pattern has been extremely useful in working with SOAP because it
allows SOAP's object serialization to convert directly to nodes, with
accessors keeping their namespaces if or when they are used.

  -- Ken

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.