
Stefan Behnel <behnel_ml@gkec.informatik.tu-darmstadt.de> schrieb am 23.06.2006 12:54:26:
+ def DefaultNamespace(): + """Retrieve the namespace object associated with the default namespace URI + ('*'). Creates a new default if it does not yet exist.""" + return Namespace('*') +
I don't think DefaultNamespace is a good name, as this is not related to namespaces at all.
Right, that's probably similarly confusing as I found the heading "Implementing namespaces with the namespace class" in the lxml doc ;-) How about renaming this to "Associating custom element classes with namespaces"
Of course one would have to think about what default registry key/URI to use for the fallback, I simply took '*'.
Not a bad choice, as it's already used in getiterator(), findall() etc. Although no-one can prevent you from using '*' as a namespace URI...
Is there some string literal that is actually invalid as a URI? Maybe s.th. like this would be best. Or maybe remove the _utf8() conversion for the namespace registry keys and use some AnyNamespace object as the default dict key.
I think a better API would be an explicit module level function for setting the default element class.
The nice thing about staying close to the existing solution is that it is still possible to have per-tagname-registered custom element classes, if you wish. Holger Der Inhalt dieser E-Mail ist vertraulich. Falls Sie nicht der angegebene Empfänger sind oder falls diese E-Mail irrtümlich an Sie adressiert wurde, verständigen Sie bitte den Absender sofort und löschen Sie die E-Mail sodann. Das unerlaubte Kopieren sowie die unbefugte Übermittlung sind nicht gestattet. Die Sicherheit von Übermittlungen per E-Mail kann nicht garantiert werden. Falls Sie eine Bestätigung wünschen, fordern Sie bitte den Inhalt der E-Mail als Hardcopy an. The contents of this e-mail are confidential. If you are not the named addressee or if this transmission has been addressed to you in error, please notify the sender immediately and then delete this e-mail. Any unauthorized copying and transmission is forbidden. E-Mail transmission cannot be guaranteed to be secure. If verification is required, please request a hard copy version.