Skip to content

Commit

Permalink
show console when xml is not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
YUJIANDE committed Jun 7, 2013
1 parent 26b663d commit d650b40
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion indentxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ def indent(self, s):
s = re.compile(b'>\s+([^\s])', re.DOTALL).sub(b'>\g<1>', s)
# replace tags to convince minidom process cdata as text
s = s.replace(b'<![CDATA[', b'%CDATAESTART%').replace(b']]>', b'%CDATAEEND%')
s = parseString(s).toprettyxml()
try:
s = parseString(s).toprettyxml()
except Exception, e:
sublime.active_window().run_command("show_panel", {"panel": "console", "toggle": True})
raise e
# remove line breaks
s = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL).sub('>\g<1></', s)
# restore cdata
Expand Down

0 comments on commit d650b40

Please sign in to comment.