[
Lists Home |
Date Index |
Thread Index
]
- From: Ken MacLeod <ken@bitsko.slc.ut.us>
- To: xml-dev@lists.xml.org
- Date: Sat, 30 Dec 2000 11:59:07 -0600
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
|