| 225 | |
| 226 | |
| 227 | def SeekToNode(node1, child2): |
| 228 | # A text node does not have properties. |
| 229 | if child2.nodeType == Node.TEXT_NODE: |
| 230 | return None |
| 231 | |
| 232 | # Get the name of the current node. |
| 233 | current_name = child2.getAttribute("Name") |
| 234 | if not current_name: |
| 235 | # There is no name. We don't know how to merge. |
| 236 | return None |
| 237 | |
| 238 | # Look through all the nodes to find a match. |
| 239 | for sub_node in node1.childNodes: |
| 240 | if sub_node.nodeName == child2.nodeName: |
| 241 | name = sub_node.getAttribute("Name") |
| 242 | if name == current_name: |
| 243 | return sub_node |
| 244 | |
| 245 | # No match. We give up. |
| 246 | return None |
| 247 | |
| 248 | |
| 249 | def MergeAttributes(node1, node2): |