當前位置: 首頁>>代碼示例>>Python>>正文


Python Action.to_xml方法代碼示例

本文整理匯總了Python中Action.Action.to_xml方法的典型用法代碼示例。如果您正苦於以下問題:Python Action.to_xml方法的具體用法?Python Action.to_xml怎麽用?Python Action.to_xml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Action.Action的用法示例。


在下文中一共展示了Action.to_xml方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Schema

# 需要導入模塊: from Action import Action [as 別名]
# 或者: from Action.Action import to_xml [as 別名]

#.........這裏部分代碼省略.........
			return
		builder =""
		builder += "\nSchema %d: Added at: %d\n"%(self.id, self.added_ID)
		builder =="=======\n"

		builder +="Activated: %0.2f times, Success: %0.2f times, Parent_schemas: %s, Child_schemas: %s\n"%(float(self.activations), float(self.successes),str(self.parent_schemas), str(self.child_schemas))

		builder +="\nPre-Conditions:\n"

		builder += self.preconditions.to_concrete_string()

		builder +="\nAssociated Pre-Conditions:\n"

		builder += self.associated_preconditions.to_concrete_string()

		builder += "\nAction:\n"
		if (self.action != None):
			builder +=self.action.to_concrete_string()
		else:
			builder += "No action assigned.\n"

		builder +="\nPost-Conditions:\n"
		builder +=self.postconditions.to_concrete_string()

		builder +="\nAssociated Observations:\n"
		builder += self.associated_observations.to_concrete_string()

		builder +="\nDisappeared Observations:\n"
		builder += self.disappeared_observations.to_concrete_string()

		builder += "\n"
		return builder

	def to_xml(self):
		"""Return schema in XML format"""
		c = " "; d = " "
		for a in self.parent_schemas:
			c +="%s "%str(a)
		for b in self.child_schemas:
			d +="%s "%str(b)
		builder = ""
		builder += "<schema id='%d' added_ID= '%d' activations='%f' successes = '%f' Parent_schemas =  '%s' Child_schemas = '%s'  Executions = '%s' >\n"%(self.id, self.added_ID, self.activations, self.successes, c, d, str(self.execution_ID))
		builder += "<preconditions>\n"
		builder += self.preconditions.to_xml()
		builder += "</preconditions>\n"
		builder += "<associated_preconditions>\n"
		builder += self.associated_preconditions.to_xml()
		builder += "</associated_preconditions>\n"
		if(self.action != None):
			builder += self.action.to_xml()
		builder += "<postconditions>\n"
		builder += self.postconditions.to_xml()
		builder += "</postconditions>\n"
		builder += "<associated_observations>\n"
		builder += self.associated_observations.to_xml()
		builder += "</associated_observations>\n"
		builder += "<disappeared_observations>\n"
		builder += self.disappeared_observations.to_xml()
		builder += "</disappeared_observations>\n"
		builder += "</schema>\n"
		#print "Schema added:", self.id
		"""if self.generalised and len(self.failed_schemas) >0:
			for s in self.failed_schemas:
				c = " "; d = " "
				for a in self.parent_schemas:
					c +="%s "%str(a)
開發者ID:kumar54,項目名稱:Dev-PSchema,代碼行數:70,代碼來源:Schema.py


注:本文中的Action.Action.to_xml方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。