[Oval-commits] r72 - trunk/tools/oval/definition

Pavel Vinogradov blaze-guest at alioth.debian.org
Wed Jul 11 19:23:26 UTC 2007


Author: blaze-guest
Date: 2007-07-11 19:23:26 +0000 (Wed, 11 Jul 2007)
New Revision: 72

Modified:
   trunk/tools/oval/definition/generator.py
Log:
Fix errors in definitions xmlns name. Now pass xsd validation.

Modified: trunk/tools/oval/definition/generator.py
===================================================================
--- trunk/tools/oval/definition/generator.py	2007-07-11 15:52:21 UTC (rev 71)
+++ trunk/tools/oval/definition/generator.py	2007-07-11 19:23:26 UTC (rev 72)
@@ -82,11 +82,11 @@
 	
 	if not testsHash["dpkgObj"].has_key(name):
 		objectId = __getNewId ("object");
-		object = __createXMLElement("linux-def:dpkginfo_object",
+		object = __createXMLElement("dpkginfo_object",
 			attrs={"id":objectId, 
 				"version":"1",
-				"comment":"none"})
-		object.appendChild ( __createXMLElement ("linux-def:name", name))
+				"xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"})
+		object.appendChild ( __createXMLElement ("name", name))
 		objects.appendChild (object)
 
 		testsHash["dpkgObj"][name] = objectId
@@ -102,13 +102,13 @@
 	if not testsHash["dpkgSte"].has_key(operation) or not testsHash["dpkgSte"][operation].has_key(value):
 		stateId = __getNewId ("state")
 
-		state = __createXMLElement("linux-def:dpkginfo_state", 
+		state = __createXMLElement("dpkginfo_state", 
 			attrs={"id":stateId, 
 				"version":"1",
-				"comment":"none"})
-		state.appendChild ( __createXMLElement 
-				("linux-def:evr", value, 
-						  			{"datatype":"evr_string", "operation":operation}))
+				"xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"})
+		state.appendChild ( __createXMLElement ("evr", value, 
+						  			{"datatype":"evr_string", 
+									   "operation":operation}))
 		states.appendChild (state)
 	
 		testsHash["dpkgSte"][operation] = {value : stateId}
@@ -119,15 +119,16 @@
 	""" Generate OVAL DPKG test """
 	
 	ref = __getNewId ("test")
-	test = __createXMLElement("linux-def:dpkginfo_test", 
+	test = __createXMLElement("dpkginfo_test", 
 			attrs={"id":ref, 
 				"version":"1", 
 				"check":"all",
 				"check_existence":"at_least_one_exists",
-				"comment":"none"
+				"comment":"none",
+				"xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"
 			})
-	test.appendChild ( __createXMLElement("linux-def:object", attrs={"object_ref" : __createOVALObject (name)}))
-	test.appendChild ( __createXMLElement("linux-def:state", attrs={"state_ref" : __createOVALState (version)}))
+	test.appendChild ( __createXMLElement("object", attrs={"object_ref" : __createOVALObject (name)}))
+	test.appendChild ( __createXMLElement("state", attrs={"state_ref" : __createOVALState (version)}))
 	tests.appendChild(test)
 
 	return (ref)
@@ -139,12 +140,13 @@
 
 		ref = __getNewId("test")
 		
-		test = __createXMLElement("linux-def:dpkginfo_test", 
+		test = __createXMLElement("dpkginfo_test", 
 				attrs={"id":ref, 
 					"version":"1", 
 					"check":"all",
 					"check_existence":"at_least_one_exists",
-					"comment":"none"
+					"comment":"none",
+					"xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"
 			})
 		
 		if testType == "release":
@@ -152,8 +154,8 @@
 		else:
 			objectId = __createOVALObject ("architecture")
 		
-		test.appendChild ( __createXMLElement("linux-def:object", attrs={"object_ref" : objectId}))
-		test.appendChild ( __createXMLElement("linux-def:state", attrs={"state_ref" : __createOVALState (value, "equals")}))
+		test.appendChild ( __createXMLElement("object", attrs={"object_ref" : objectId}))
+		test.appendChild ( __createXMLElement("state", attrs={"state_ref" : __createOVALState (value, "equals")}))
 		tests.appendChild(test)
 				
 		testsHash[testType][value] = ref




More information about the Oval-commits mailing list