How To Install Xmllint Windows

пятница 06 декабряadmin
How To Install Xmllint Windows Rating: 9,4/10 4912 reviews

Xmllint - Unix, Linux Command - The xmllint program parses one or more XML files, specified on the command line as XML-FILE (or the standard input if the filename provided is - ).

Complete instructions for getting xmllint to work with Sublime Text 2 and Windows.
Instructions.txt
1) Download XMLLint for Windows here:
https://code.google.com/p/xmllint/downloads/list
2) Choose the xmllint-1.0.exe version and save somewhere in your Windows path (such as your user path).
3) Rename the file to: xmllint.exe (remove the -1.0)
4) Open Sublime Text 2
5) Click Preferences -> Browse Packages (opens up your Packages folder in Windows Explorer).
6) Open up the 'User' folder in your Packages folder.
7) Create a file named: tidy_xml_lint.py
8) Open that file in, well, Sublime Text 2 of course!
9) Paste the contents of the 'tidy_xml_lint.py' gist on this page.
10) Save the file and restart Sublime Text 2. Sometimes, you don't have to restart but I find it helps most of the time.
11) Click Preferences -> Keybindings - User
12) Alter that file so that it contains the 'Keybindings - User' gist on this page.
13) Be sure the change the keybindings to what you prefer. This example uses ALT-SHIFT-X.
14) Save the file.
15) Go back to your Packages -> User folder in Windows Explorer.
16) Create (or open if it exists) a file called: Main.sublime-menu
17) Open that file in Sublime Text 2
18) Alter the file so that it includes the 'Main.sublime-menu' gist on this page.
19) Save and relaunch Sublime Text 2 for good measure.
20) Enjoy.
You can now press 'ALT-SHIFT-X' to format either a selection of text or the entire document if nothing is selected.
Keybindings - User.txt
[
{ 'keys': ['alt+shift+x'], 'command': 'tidy_xml_lint' }
]
Main.sublime-menu
[
{
'caption':'Selection',
'children': [
{
'caption':'Format',
'children': [
{
'caption':'Tidy with XML Lint',
'command':'tidy_xml_lint'
}
],
'id':'format'
}
],
'id':'selection'
}
]
tidy_xml_lint.py
import sublime, sublime_plugin, subprocess
classTidyXmlLintCommand(sublime_plugin.TextCommand):
defrun(self, edit):
command ='xmllint -format -encode utf-8 -'
# help from http://www.sublimetext.com/forum/viewtopic.php?f=2&p=12451
ifself.view.sel()[0].empty():
xmlRegion = sublime.Region(0, self.view.size())
else:
xmlRegion =self.view.sel()[0]
p = subprocess.Popen(command, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
result, err = p.communicate(self.view.substr(xmlRegion).encode('utf-8'))
if err !=b'':
self.view.set_status('xmllint', 'xmllint: '+ err.decode('utf-8'))
sublime.set_timeout(self.clear,10000)
else:
self.view.replace(edit, xmlRegion, result.decode('utf-8'))
sublime.set_timeout(self.clear,0)
defclear(self):
self.view.erase_status('xmllint')
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

This linter plugin for SublimeLinter provides an interface to xmllint.It will be used with files that have the 'XML' syntax.

Installation

SublimeLinter must be installed in order to use this plugin.

Please use Package Control to install the linter plugin.

Before using this plugin, ensure that xmllint is installed on your system.On recent versions of Mac OS X, xmllint comes pre-installed. To install xmllint on other platforms, do the following:

  1. On Linux:

  2. On Windows, follow the instructions here. There is another version on code.google.com, but that version is incompatible with this plugin. Need for speed pro street cd keygen.

Please make sure that the path to xmllint is available to SublimeLinter.The docs cover troubleshooting PATH configuration.

Settings

  • SublimeLinter settings: http://sublimelinter.com/en/latest/settings.html
  • Linter settings: http://sublimelinter.com/en/latest/linter_settings.html

xmllint has many possible command line arguments ('args') which may be passed via the Linter settings.