On Wed, 2009-03-25 at 23:23 +0900, ara.t.howard wrote:
> On Mar 25, 2009, at 3:11 AM, Andrew S. Townley wrote:
> 
> > How does tagz handle namespaces?  I have to say that what you've done
> > here looks very impressive, and it seems to be exactly the kind of  
> > thing
> > I was looking for.  However, I need to make sure it has support for
> > namespaces, both for elements and for attributes before I can start
> > using it in anger.
> >
> > Any examples/thoughts on how this could be done?
> >
> > Cheers,
> 
> nothing explicit, but it'd be pretty simple to make some helper  
> methods using this technique
> 
>    >> send('foo:bar_', 'bar:foo' => 42){}
>    => "<foo:bar bar:foo=\"42\"/>"
> 
> i'll mull on that.

Thanks.

If you had to register the namespaces first in some kind of tagz
registry, maybe you could do something by handling the NameError when
you did:

foo.bar_('bar:foo' => 42)

If it had registered a namespace prefix of foo, then it'd just "do the
right thing", otherwise, you'd get the normal name error.  This would
probably be the most logical syntax, but it's way beyond my Ruby magical
abilities to figure out how to actually make it work.

Still, I think it'd be the most readable of the proposed approaches...
I don't want to have to find unicode characters on my keyboard! :)

Cheers,

ast
-- 
Andrew S. Townley <ast / atownley.org>
http://atownley.org