Re: [xml-bindings]Naespaces of attributes in python API



On Wed, Jun 19, 2002 at 07:53:47PM +0200, rm fabula de wrote:
> Which brings me to the core of my question (which might be a bit off-topic
> on this list): shouldn't prefixing be left to libxml? After all, the namespace
> prefix is just a shortcut to the real namespace and doesn't carry any semantic.

  Wel, in theory, yes. In practice people usually try to fix the prefixes too.

> Having to provide a prefix for a new namespace seems strange and leads to
> code that must test for errors that could be easily avoided:
> 
>  # instead of
>   
>   node.newNs('http://somewhere/over/the/rainbow', 'kansas')
> 
>  # we need to do
> 
>  done = None
>  suff = 0 
>  while(not done):
>    try:
>      node.newNs('http://somewhere/over/the/rainbow', 'pre' + str(suff)) 
>      done = 1
>    except treeError:
>      suff = suff + 1

  Hum, does node.newNs really raise an exception ? Maybe I can't remember ...

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]