I'm trying to pull a particular attribute "[@severity]" from a Rule.
To get the title, I use:
vuln['title'] = group.xpath('Rule/title').text
However, this doesn't get the attribute:
vuln['severity'] = group.xpath("Rule[@severity]").text
Snippet of the XML. In this case I want vuln['severity'] to have the string "medium". Right now it's getting several of the child fields.
#(Element:0x3f89f9a80120 {
name = "Rule",
attributes = [
#(Attr:0x3f89f9a7d830 {
name = "id",
value = "SV-68627r3_rule"
}),
#(Attr:0x3f89f9a7d7e0 {
name = "severity",
value = "medium"
}),
#(Attr:0x3f89f9a7d7cc {
name = "weight",
value = "10.0"
})],
children = [
#(Text "\n"),
#(Element:0x3f89f9a6edbc {
name = "version",
children = [
#(Text "RHEL-06-000163")]
}),
#(Text "\n"),