# HG changeset patch # User paulb # Date 1134334111 0 # Node ID b726339baa2d8b650fda6fcb91716f808dfbee69 # Parent 8cac558909006022c366822c6d82696e504cfe3d [project @ 2005-12-11 20:48:31 by paulb] Reverted createDocument change. Introduced xmlns attribute usage along with removing namespace information on newly created elements for null namespaces. This is done in order to avoid the distinction between null namespaces and absent namespaces when a null namespace node is set on an element. diff -r 8cac55890900 -r b726339baa2d libxml2dom/macrolib/macrolib.py --- a/libxml2dom/macrolib/macrolib.py Sun Dec 11 20:46:06 2005 +0000 +++ b/libxml2dom/macrolib/macrolib.py Sun Dec 11 20:48:31 2005 +0000 @@ -232,8 +232,10 @@ libxml2mod.xmlSetNs(new_node, new_ns) # If the namespace is empty, set a "null" declaration. else: - new_ns = libxml2mod.xmlNewNs(new_node, "", prefix) - libxml2mod.xmlSetNs(new_node, new_ns) + #new_ns = libxml2mod.xmlNewNs(new_node, "", prefix) + #libxml2mod.xmlSetNs(new_node, new_ns) + libxml2mod.xmlSetNs(new_node, None) + Node_setAttribute(new_node, "xmlns", "") return new_node def Node_createElement(node, name): @@ -359,11 +361,8 @@ # NOTE: Fixed to use version 1.0 only. d = libxml2mod.xmlNewDoc("1.0") if localName is not None: - # NOTE: Verify that this is really what should occur. - if namespaceURI is not None: - root = Node_createElementNS(d, namespaceURI, localName) - else: - root = Node_createElement(d, localName) + # NOTE: Verify that this is always what should occur. + root = Node_createElementNS(d, namespaceURI, localName) Node_appendChild(d, root) if doctype is not None: libxml2mod.xmlCreateIntSubset(d, doctype.localName, doctype.publicId, doctype.systemId)