3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/nexpose/test.rb', line 3
def self.new(xml_node)
content =
if xml = xml_node.at_xpath('./Paragraph | ./ContainerBlockElement')
nested_paragraphs = xml.xpath('.//Paragraph')
content = nested_paragraphs.children.map do |node|
case node.name
when 'text'
node.text.strip
when 'URLLink'
node['LinkURL']
end
end.compact
content.map(&:strip).reject(&:empty?).join("\n")
else
'n/a'
end
{
id: xml_node.attributes['id'],
status: xml_node.attributes['status'],
content: content,
port: xml_node.attributes['port'],
protocol: xml_node.attributes['protocol']
}
end
|