]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/syntax_checkers/xml.vim
55c0cdd31984ba45eda293b9f3dddd8da75e5fa0
[rbdr/dotfiles] / vim / syntax_checkers / xml.vim
1 "============================================================================
2 "File: xml.vim
3 "Description: Syntax checking plugin for syntastic.vim
4 "Maintainer: Sebastian Kusnier <sebastian at kusnier dot net>
5 "License: This program is free software. It comes without any warranty,
6 " to the extent permitted by applicable law. You can redistribute
7 " it and/or modify it under the terms of the Do What The Fuck You
8 " Want To Public License, Version 2, as published by Sam Hocevar.
9 " See http://sam.zoy.org/wtfpl/COPYING for more details.
10 "
11 "============================================================================
12
13 " You can use a local installation of DTDs to significantly speed up validation
14 " and allow you to validate XML data without network access, see xmlcatalog(1)
15 " and http://www.xmlsoft.org/catalog.html for more information.
16
17 if exists("loaded_xml_syntax_checker")
18 finish
19 endif
20 let loaded_xml_syntax_checker = 1
21
22 "bail if the user doesnt have tidy or grep installed
23 if !executable("xmllint")
24 finish
25 endif
26
27 function! SyntaxCheckers_xml_GetLocList()
28
29 let makeprg="xmllint --xinclude --noout --postvalid " . shellescape(expand("%:p"))
30 let errorformat='%E%f:%l:\ error\ :\ %m,
31 \%-G%f:%l:\ validity\ error\ :\ Validation\ failed:\ no\ DTD\ found\ %m,
32 \%W%f:%l:\ warning\ :\ %m,
33 \%W%f:%l:\ validity\ warning\ :\ %m,
34 \%E%f:%l:\ validity\ error\ :\ %m,
35 \%E%f:%l:\ parser\ error\ :\ %m,
36 \%E%f:%l:\ %m,
37 \%-Z%p^,
38 \%-G%.%#'
39 let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
40
41 return loclist
42 endfunction