alek-sys / sublimetext_indentxml

Plugin for Sublime Text editor for reindenting XML and JSON files
MIT License
534 stars 135 forks source link

Don't work in sublime text 2 #67

Closed morojosa closed 8 years ago

morojosa commented 9 years ago

Hello,

Thanks for best job with this plugin.

The XML have 491800 characters.

The error is this:

Traceback (most recent call last): File ".\sublimeplugin.py", line 362, in run File ".\indentxml.py", line 49, in run File ".\indentxml.py", line 96, in indent xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 491786

Regards and @goto thanks

jrista commented 9 years ago

I am actually having the same problem, Sublime Text 3 in my case though:

reloading plugin sublimetext_indentxml.indentxml
plugins loaded
Package Control: Skipping automatic upgrade, last run at 2014-11-03 11:17:04, next run at 2014-11-03 12:17:04 or after
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "C:\Users\jrista\AppData\Roaming\Sublime Text  3\Packages\sublimetext_indentxml\indentxml.py", line 49, in run
    s = self.indent(s)
  File "C:\Users\jrista\AppData\Roaming\Sublime Text 3\Packages\sublimetext_indentxml\indentxml.py", line 96, in indent
    raise e
  File "C:\Users\jrista\AppData\Roaming\Sublime Text 3\Packages\sublimetext_indentxml\indentxml.py", line 93, in indent
    s = parseString(s).toprettyxml()
  File "./xml/dom/minidom.py", line 1970, in parseString
  File "./xml/dom/expatbuilder.py", line 926, in parseString
  File "./xml/dom/expatbuilder.py", line 221, in parseString
xml.parsers.expat.ExpatError: no element found: line 1, column 0
frhd commented 9 years ago

Same here in ST3.

Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "indentxml in /home/f/.config/sublime-text-3/Installed Packages/Indent XML.sublime-package", line 44, in run
  File "indentxml in /home/f/.config/sublime-text-3/Installed Packages/Indent XML.sublime-package", line 96, in indent
  File "indentxml in /home/f/.config/sublime-text-3/Installed Packages/Indent XML.sublime-package", line 93, in indent
  File "./xml/dom/minidom.py", line 1970, in parseString
  File "./xml/dom/expatbuilder.py", line 926, in parseString
  File "./xml/dom/expatbuilder.py", line 221, in parseString
xml.parsers.expat.ExpatError: syntax error: line 1, column 0
timothyclifford commented 9 years ago

Same...

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "indentxml in C:\Users\tim.clifford\AppData\Roaming\Sublime Text 3\Installed Packages\Indent XML.sublime-package", line 44, in run
  File "indentxml in C:\Users\tim.clifford\AppData\Roaming\Sublime Text 3\Installed Packages\Indent XML.sublime-package", line 77, in indent
  File "indentxml in C:\Users\tim.clifford\AppData\Roaming\Sublime Text 3\Installed Packages\Indent XML.sublime-package", line 96, in indent
  File "indentxml in C:\Users\tim.clifford\AppData\Roaming\Sublime Text 3\Installed Packages\Indent XML.sublime-package", line 93, in indent
  File "./xml/dom/minidom.py", line 1970, in parseString
  File "./xml/dom/expatbuilder.py", line 926, in parseString
  File "./xml/dom/expatbuilder.py", line 221, in parseString
xml.parsers.expat.ExpatError: undefined entity: line 1, column 77
iBobik commented 9 years ago

Same

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 556, in run_
    return self.run(edit)
  File "indentxml in /Users/Bobik/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 49, in run
  File "indentxml in /Users/Bobik/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 77, in indent
  File "indentxml in /Users/Bobik/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 96, in indent
  File "indentxml in /Users/Bobik/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 93, in indent
  File "./xml/dom/minidom.py", line 1970, in parseString
  File "./xml/dom/expatbuilder.py", line 926, in parseString
  File "./xml/dom/expatbuilder.py", line 221, in parseString
xml.parsers.expat.ExpatError: mismatched tag: line 1, column 285

on HTML snippet:

<div class="field field-name-field-photos field-type-image field-label-hidden"><div class="field-items"><div class="field-item even"><img src="https://example.com/sites/default/files/styles/thumbnail/public/tour-photos/bsoz-iv/pokoj-11.jpg?itok=v_qDYn85" width="100" height="75"></div><div class="field-item odd"><img src="https://example.com/sites/default/files/styles/thumbnail/public/tour-photos/bsoz-iv/ivan-p2.5.jpg?itok=j6BcdN9P" width="100" height="67"></div><div class="field-item even"><img src="https://example.com/sites/default/files/styles/thumbnail/public/tour-photos/bsoz-iv/ivan-2.jpg?itok=8ZpgrfF2" width="67" height="100"></div><div class="field-item odd"><img src="https://example.com/sites/default/files/styles/thumbnail/public/tour-photos/bsoz-iv/ivan-p2.1.jpg?itok=Pc0poyqW" width="100" height="67"></div><div class="field-item even"><img src="https://example.com/sites/default/files/styles/thumbnail/public/tour-photos/bsoz-iv/ivan1.jpg?itok=1yNM8e0L" width="100" height="67"></div><div class="field-item odd"><img src="https://example.com/sites/default/files/styles/thumbnail/public/tour-photos/bsoz-iv/ivan-z-ulice.jpg?itok=TLNsh3O0" width="100" height="75"></div><div class="field-item even"><img src="https://example.com/sites/default/files/styles/thumbnail/public/tour-photos/bsoz-iv/fotografia0809.jpg?itok=yAY3g7Li" width="100" height="75"></div></div></div>
cheneysan commented 9 years ago

Possible workaround: File -> Reopen with Encoding -> UTF-8 Ctrl+Shift+P -> Indent XML

alek-sys commented 8 years ago

Hi all, Cannot comment the original question because there is no sample file attached.

Regarding HTML snippet - the given example is not a valid XML (img tags are not closed), please use XHTML to be able to use this plugin.

Thanks, Alexey.