def process_xml(self, xml: str) -> None:
'''
Parse Outcome Request data from XML.
'''
root = t.cast(t.Mapping, objectify.fromstring(xml))
self.message_identifier = str(
root['imsx_POXHeader']['imsx_POXRequestHeaderInfo']
['imsx_messageIdentifier']
)
try:
result = root['imsx_POXBody']['replaceResultRequest']
self.operation = REPLACE_REQUEST
# Get result sourced id from resultRecord
self.lis_result_sourcedid = result.resultRecord.\
sourcedGUID.sourcedId
self.score = str(result.resultRecord.result.resultScore.textString)
except (KeyError, TypeError, AttributeError):
pass
try:
result = root['imsx_POXBody']['deleteResultRequest']
self.operation = DELETE_REQUEST
# Get result sourced id from resultRecord
self.lis_result_sourcedid = result['resultRecord']['sourcedGUID'
]['sourcedId']
except (KeyError, TypeError):
pass
try:
result = root['imsx_POXBody']['readResultRequest']
self.operation = READ_REQUEST
# Get result sourced id from resultRecord
self.lis_result_sourcedid = result['resultRecord']['sourcedGUID'
]['sourcedId']
except (KeyError, TypeError):
pass
评论列表
文章目录