1.1 --- a/libxml2dom/__init__.py Fri Jun 20 21:47:22 2008 +0200
1.2 +++ b/libxml2dom/__init__.py Mon Aug 25 22:30:19 2008 +0200
1.3 @@ -59,10 +59,21 @@
1.4 # Factory functions.
1.5
1.6 def get_node(self, _node, context_node):
1.7 +
1.8 + # Return the existing document.
1.9 +
1.10 if Node_nodeType(_node) == context_node.DOCUMENT_NODE:
1.11 return context_node.ownerDocument
1.12 +
1.13 + # Return an attribute using the parent of the attribute as the owner
1.14 + # element.
1.15 +
1.16 elif Node_nodeType(_node) == context_node.ATTRIBUTE_NODE:
1.17 - return Attribute(_node, self, context_node.ownerDocument, context_node)
1.18 + return Attribute(_node, self, context_node.ownerDocument,
1.19 + self.get_node(Node_parentNode(_node), context_node))
1.20 +
1.21 + # Return other nodes.
1.22 +
1.23 else:
1.24 return Node(_node, self, context_node.ownerDocument)
1.25