Fix Broken XML Namespace Handling
nodeName is set to ns2:metadata and not just metadata when namespaces are specified using first example in the defect. Explicitly check namespaces where necessary and use localName instead of nodeName. Ensure that scheduler_hints are picked up from the correct namespace fix lines too long from pep8 Fixes bug 887191 Change-Id: I5db2b575d24f6b1b358489e309af7e6ace2950fd
This commit is contained in:
committed by
Gerrit Code Review
parent
f1e5fbf92a
commit
10caf4b48f
@@ -244,17 +244,26 @@ class XMLDeserializer(TextDeserializer):
|
||||
listnames)
|
||||
return result
|
||||
|
||||
def find_first_child_named_in_namespace(self, parent, namespace, name):
|
||||
"""Search a nodes children for the first child with a given name"""
|
||||
for node in parent.childNodes:
|
||||
if (node.localName == name and
|
||||
node.namespaceURI and
|
||||
node.namespaceURI == namespace):
|
||||
return node
|
||||
return None
|
||||
|
||||
def find_first_child_named(self, parent, name):
|
||||
"""Search a nodes children for the first child with a given name"""
|
||||
for node in parent.childNodes:
|
||||
if node.nodeName == name:
|
||||
if node.localName == name:
|
||||
return node
|
||||
return None
|
||||
|
||||
def find_children_named(self, parent, name):
|
||||
"""Return all of a nodes children who have the given name"""
|
||||
for node in parent.childNodes:
|
||||
if node.nodeName == name:
|
||||
if node.localName == name:
|
||||
yield node
|
||||
|
||||
def extract_text(self, node):
|
||||
|
||||
Reference in New Issue
Block a user