diff --git a/code_examples/example.xml b/code_examples/example.xml index 56cb1d8..522850b 100644 --- a/code_examples/example.xml +++ b/code_examples/example.xml @@ -1,12 +1,8 @@ - - + + fjjgg - + diff --git a/mode/xml.py b/mode/xml.py index 3af54a3..aef15ca 100644 --- a/mode/xml.py +++ b/mode/xml.py @@ -1,4 +1,4 @@ -import color, mode +import color, method, mode from lex import Grammar, PatternRule, RegionRule class TagGrammar(Grammar): @@ -17,6 +17,13 @@ class XMLGrammar(Grammar): RegionRule(r'xml_tag', r'<', TagGrammar, r'/?>'), ] +class XmlValidate(method.shell.Exec): + '''Valid the buffer's contents as valid XML.''' + show_success = True + args = [] + def _execute(self, w, **vargs): + self._doit(w, w.buffer.path, 'xmlwf %(path)r', cmdname='xml-validate') + class XML(mode.Fundamental): modename = 'XML' extensions = ['.xml', '.xml.in'] @@ -31,5 +38,6 @@ class XML(mode.Fundamental): 'xml_tag.string.end': ('green', 'default'), 'xml_tag.end': ('default', 'default'), } + actions = [XmlValidate] install = XML.install