Я анализирую xml, в котором есть несколько записей, аналогичных приведенным ниже:
<ReportItem port="22" svc_name="ssh" protocol="tcp" severity="0" pluginID="22964"
pluginName="Service Detection" pluginFamily="Service detection">
<description>Nessus was able to identify the remote service by its banner or by looking at the error
message it sends when it receives an HTTP request.</description>
<fname>find_service.nasl</fname>
<plugin_modification_date>2019/08/14</plugin_modification_date>
<plugin_name>Service Detection</plugin_name>
<plugin_publication_date>2007/08/19</plugin_publication_date>
<plugin_type>remote</plugin_type>
<risk_factor>None</risk_factor>
<script_version>1.177</script_version>
<solution>n/a</solution>
<synopsis>The remote service could be identified.</synopsis>
<plugin_output>An SSH server is running on this port.</plugin_output>
</ReportItem>
Я хочу запросить текстовое значение plugin_name
hostIter = iter(hostsByIP)
for host in hostIter:
reportIter = iter(host.elements.childNodes)
for reportItem in reportIter:
childIter = iter(reportItem.childNodes)
for reportChild in childIter:
print(reportChild.nodeValue)
#if child.nodeValue == "Traceroute Information":
reportChild.nodeValue возвращает 'Нет '' / n '' Нет '... и т. Д.
reportChild.value выдает ошибку' Текст 'объект не имеет атрибута' value '
reportChild.localName правильно возвращает' plugin_name'и т. д., но также' нет '(что означает, что представляет текстовый узел?)