Fix XML to JSON converter

Benchmark MAY contain Group elements to group rules that
could be turned on/off together. Group elements could be
nested.

This commit adds support for Benchmark without any Group element.

Change-Id: I1fd0cfb4ee3af708d89e9a3fec1997153f64d6a5
Related-Prod: PROD-29863
diff --git a/_modules/oscap/utils.py b/_modules/oscap/utils.py
index d81825d..5f90ef0 100644
--- a/_modules/oscap/utils.py
+++ b/_modules/oscap/utils.py
@@ -62,22 +62,28 @@
     return groups
 
 
-def _get_rules(groups):
+def _get_rules(document, groups):
+    def _append_rule(rules, rule):
+        rules[rule['id']] = {
+            'title': rule.title.cdata,
+            'severity': rule['severity'],
+            'ident': rule.ident.cdata,
+            'description': rule.description.cdata}
+
     rules = {}
+    if hasattr(document, 'Rule'):
+        for rule in document.Rule:
+            _append_rule(rules, rule)
     for group in groups:
         if hasattr(group, 'Rule'):
             for rule in group.Rule:
-                rules[rule['id']] = {
-                    'title': rule.title.cdata,
-                    'severity': rule['severity'],
-                    'ident': rule.ident.cdata,
-                    'description': rule.description.cdata}
+                _append_rule(rules, rule)
     return rules
 
 
 def _parse_xccdf_doc(document):
     groups = _get_flatten_groups(document.Benchmark)
-    rules = _get_rules(groups)
+    rules = _get_rules(document.Benchmark, groups)
 
     results = []
     for result in document.Benchmark.TestResult.rule_result: