本文整理汇总了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)