pabigot / pyxb

Python XML Schema Bindings
Apache License 2.0
130 stars 74 forks source link

foo.Namespace.setPrefix('') gives wrong result #66

Closed nowox closed 7 years ago

nowox commented 8 years ago

I would like to get rid of the ns1 prefix so I set the prefix to an empty string. Instead of removing the prefix completely, pyxb adds empty prefixes:

 <:foo></:foo> 
pabigot commented 8 years ago

That would be undefined behavior. To remove the prefix give your document a default namespace.

import myns
import pyxb.utils.domutils
pyxb.utils.domutils.BindingDOMSupport.SetDefaultNamespace(myns.Namespace)
nowox commented 8 years ago

Good to learn that. It would be nice to find it on the documentation.

pabigot commented 8 years ago

Resolution would be that PyXB should reject the attempt to set an empty string prefix.