Re: Naespaces of attributes in python API
Daniel Veillard <[email protected]> Thu, 20 Jun 2002 02:37:17 -0400
| Newsgroups | gmane.comp.gnome.lib.xml.bindings |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 19, 2002 at 07:53:47PM +0200, [email protected] 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/ [email protected] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/