# Path: servicebus/event.py
# class Event(object):
#     def __init__(self, eid, category, service, token, params, version):
#         self.id = eid
#         self.category = category
#         self.service = service
#         self.token = token
#         self.params = params
#         self.version = version


import json
import hashlib
from datetime import datetime, timedelta
from xml.dom.minidom import parseString
from servicebus.event import Event
        self.params = {}

    def parse(self):
        params_node = self.params_node
        self.parse_param(params_node)

    def set_params_node(self, value):
        self.params_node = value

    def parse_param(self, params_node):
        json_code = self.get_text(params_node)
        self.params = json.loads(json_code)


# XML message format:
#   <?xml version="1.0"?>
#   <event version="1">
#       <id>EVENT_ID</id>
#       <token>EVENT_TOKEN</token>
#       <catgory>EVENT_CATEGORY</catgory>
#       <service>SERVICE_NAME</service>
#       <params>
#           JSON_PARAMS
#       </params>
#   </event>
class XmlMessageParser(AbstractMessageParser, XmlParserHelper):
    def parse(self, xml_doc):
        try:
            doc = parseString(xml_doc)


# Path: servicebus/event.py
# class Event(object):
#     def __init__(self, eid, category, service, token, params, version):
#         self.id = eid
#         self.category = category
#         self.service = service
#         self.token = token
#         self.params = params
#         self.version = version


# Path: servicebus/parser.py
import json
import hashlib
from datetime import datetime, timedelta
from xml.dom.minidom import parseString
from servicebus.event import Event

        self.params = {}

    def parse(self):
        params_node = self.params_node
        self.parse_param(params_node)

    def set_params_node(self, value):
        self.params_node = value

    def parse_param(self, params_node):
        json_code = self.get_text(params_node)
        self.params = json.loads(json_code)


# XML message format:
#   <?xml version="1.0"?>
#   <event version="1">
#       <id>EVENT_ID</id>
#       <token>EVENT_TOKEN</token>
#       <catgory>EVENT_CATEGORY</catgory>
#       <service>SERVICE_NAME</service>
#       <params>
#           JSON_PARAMS
#       </params>
#   </event>
class XmlMessageParser(AbstractMessageParser, XmlParserHelper):
    def parse(self, xml_doc):
        try:
            doc = parseString(xml_doc)


            if not self.validate_xml(doc):