Skip to content

Commit

Permalink
make xml error positions easier to understand
Browse files Browse the repository at this point in the history
  • Loading branch information
keith-hall committed Jan 8, 2016
1 parent a1996e4 commit e6bd734
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
xml_trees = {}
previous_first_selection = {}
settings = None
parse_error = 'XPath - error parsing XML: '
parse_error = 'XPath - error parsing XML at '
html_cleaning_answer = {}

def settingsChanged():
Expand Down Expand Up @@ -77,7 +77,7 @@ def buildTreeForViewRegion(view, region_scope):
tree = lxml_etree_parse_xml_string_with_location(xml_string, line_number_offset, stop)
except SAXParseException as e:
global parse_error
text = str(e.getLineNumber() + line_number_offset) + ':' + str(e.getColumnNumber() + 1) + ' - ' + e.getMessage()
text = 'line ' + str(e.getLineNumber() + line_number_offset) + ', column ' + str(e.getColumnNumber() + 1) + ' - ' + e.getMessage()
view.set_status('xpath_error', parse_error + text)

return tree
Expand Down Expand Up @@ -105,7 +105,7 @@ def run(self, edit, **args):
view = self.view

global parse_error
detail = view.get_status('xpath_error')[len(parse_error):].split(' - ')[0].split(':')
detail = view.get_status('xpath_error')[len(parse_error + 'line '):].split(' - ')[0].split(', column ')
point = view.text_point(int(detail[0]) - 1, int(detail[1]) - 1)

view.sel().clear()
Expand Down

0 comments on commit e6bd734

Please sign in to comment.