xml validation

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-04-19 15:10:15 +00:00
parent 815adf18fc
commit 9b6659c7b9
2 changed files with 12 additions and 8 deletions

View File

@ -1,12 +1,8 @@
<foo some_attr='blah'
other_attr='foo'
c='9'>
<bijj a="222"
b="999">
<blah
a='1'
b='2'
c='3' />
<bijj a="222" b="999">
<blah a='1' b='2' c='3' />
fjjgg
</bar>
</bijj>
</foo>

View File

@ -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