[XML-SIG] Metadata in XBEL

Ken MacLeod ken@bitsko.slc.ut.us
31 Mar 2001 09:03:11 -0600


Uche Ogbuji <uche.ogbuji@fourthought.com> writes:

> However, I'd like [a Pythonic DOM], but *not* based on JDOM, but
> rather 100% Pythonic.  I think to do otherwise is to risk continuing
> the performance and resource-hogging properties of straightforward
> DOM ports.

The Orchard API is "near pure" Pythonic, using only objects for nodes,
and arrays and mappings for NodeLists and NamedNodeLists.  No
DOM-style iterators and manipulation.  Other behaviors, which do not
replicate built-in Python features (like normalize()) are retained.

"Near pure" means two things: 1) Orchard uses accessor overrides on
attribute lookups, to make things like element.tag_name map properly
to element.prefix and element.local_name, and 2) in refactoring the
node base class to work across non-XML nodes (like RSS or MPEG),
certain "intrinsic" properties, like Parent and NodeType are moved
into a seperate namespace.

Orchard provides namespaced-attributes on all nodes.  Not a necessity
just XML nodes, but a big win for other formats.  Namespaced
attributes are accessed using a tuple key acessing the node with
mapping syntax:

  dublin_core = "http://purl.org/dc/elements/1.1/"

  print rss_channel[(dublin_core, 'creator')]

I've recently came with an idea for an Orchard.namespace() function
which creates a name generator, so the above is more simply now:

  DC = Orchard.namespace("http://purl.org/dc/elements/1.1/")

  print rss_channel[DC.creator]

for all XML local-names which are valid Python tokens.

I've got to run now, so I'll do some more evangelizing later ;-)

  -- Ken