1.1 --- a/libxml2dom/macrolib/macrolib.py Tue May 17 14:43:19 2005 +0000
1.2 +++ b/libxml2dom/macrolib/macrolib.py Tue May 17 14:43:22 2005 +0000
1.3 @@ -164,10 +164,11 @@
1.4 prefix, localName = _get_prefix_and_localName(name)
1.5
1.6 # NOTE: Might need to be xmlSetNsProp.
1.7 - if prefix is not None:
1.8 - libxml2mod.xmlNewNsProp(node, libxml2mod.xmlNewNs(node, ns, prefix), localName, value)
1.9 - elif ns is not None and ns == libxml2mod.xmlNodeGetContent(libxml2mod.xmlNodeGetNs(node)):
1.10 + if ns is not None and ns == libxml2mod.xmlNodeGetContent(libxml2mod.xmlNodeGetNs(node)):
1.11 libxml2mod.xmlNewNsProp(node, libxml2mod.xmlNodeGetNs(node), localName, value)
1.12 + elif prefix is not None:
1.13 + new_ns = libxml2mod.xmlNewNs(node, ns, prefix)
1.14 + libxml2mod.xmlNewNsProp(node, new_ns, localName, value)
1.15 else:
1.16 # NOTE: Needs verifying: what should happen to the namespace?
1.17 # NOTE: This also catches the case where None is the element's
1.18 @@ -208,7 +209,6 @@
1.19 return new_node
1.20
1.21 def Node_createAttributeNS(node, ns, name):
1.22 - raise NotImplementedError, "Node_createAttributeNS"
1.23
1.24 # NOTE: Need to convert from Unicode.
1.25 ns, name = map(from_unicode, [ns, name])
1.26 @@ -219,11 +219,10 @@
1.27 new_ns = libxml2mod.xmlNewNs(node, ns, prefix)
1.28 else:
1.29 new_ns = None
1.30 - new_node = libxml2mod.xmlNewNsProp(node, new_ns, name, None)
1.31 + new_node = libxml2mod.xmlNewNsProp(node, new_ns, localName, None)
1.32 return new_node
1.33
1.34 def Node_createAttribute(node, name):
1.35 - raise NotImplementedError, "Node_createAttribute"
1.36
1.37 # NOTE: Need to convert from Unicode.
1.38 name = from_unicode(name)