Skip to content

Commit

Permalink
bugfix: corrected XML parsing error
Browse files Browse the repository at this point in the history
  • Loading branch information
kunpengGK committed Oct 24, 2023
1 parent 7b3d62d commit 60e1b9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion werobot/parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-

import re
import xmltodict
from werobot.messages.messages import MessageMetaClass, UnknownMessage
from werobot.messages.events import EventMetaClass, UnknownEvent
Expand All @@ -11,7 +12,8 @@ def parse_user_msg(xml):


def parse_xml(text):
xml_dict = xmltodict.parse(text)["xml"]
text_clean = re.sub(b'[\x00-\x1F]', b'', text)
xml_dict = xmltodict.parse(text_clean)["xml"]
xml_dict["raw"] = text
return xml_dict

Expand Down

0 comments on commit 60e1b9d

Please sign in to comment.