[New-bugs-announce] [issue35531] xml.etree.ElementTree Elment.find bug, fails to find tag

Justin report at bugs.python.org
Tue Dec 18 20:49:24 EST 2018


New submission from Justin <justin.a.black at gmail.com>:

When the following text it loaded in to an ElementTree Element, the find method is unable to find one of the elements without a namespace assigned to it.
```
import xml.etree.ElementTree as ElementTree

xml_text = """
<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"><ns0:Body><ns0:Fault><faultcode>a:ActionNotSupported</faultcode><faultstring xml:lang="en-US">The message with Action \'\' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</faultstring></ns0:Fault></ns0:Body></ns0:Envelope>
"""

xml = ElementTree.fromstring(xml_text)
ele = xml.find('faultstring')
ele == None #True
```

----------
components: XML
messages: 332106
nosy: spacether
priority: normal
severity: normal
status: open
title: xml.etree.ElementTree Elment.find bug, fails to find tag
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35531>
_______________________________________


More information about the New-bugs-announce mailing list