PythonでXMLをナビゲートする最も簡単な方法は何ですか?XMLを反復処理しますか?
<html>
<body>
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:body>
<getservicebyidresponse xmlns="http://www.something.com/soa/2.0/SRIManagement">
<code xmlns="">
0
</code>
<client xmlns="">
<action xsi:nil="true">
</action>
<actionmode xsi:nil="true">
</actionmode>
<clientid>
405965216
</clientid>
<firstname xsi:nil="true">
</firstname>
<id xsi:nil="true">
</id>
<lastname>
Last Name
</lastname>
<role xsi:nil="true">
</role>
<state xsi:nil="true">
</state>
</client>
</getservicebyidresponse>
</soapenv:body>
</soapenv:envelope>
</body>
</html>
私は正規表現に行き、私が必要とする行の値を取得しようとしますが、pythonの方法はありますか? xml[0][1]
などのようなもの?
https://docs.python.org/3/library/xml.etree.elementtree.html – deceze
@brunodesthuilliersは必要に応じて複製としてマークします。だからGoogleに教えてはいけません。 [再帰的にElementTreeのを使用してPythonでXMLタグを反復処理する方法?]の –
可能な複製(http://stackoverflow.com/questions/21074361/how-to-recursively-iterate-over-xml-tags-in-python-using [ERRNO 36]長すぎるファイル名:-elementtree) –