Currently the XML grammar doesn't have a restriction for XML tag to be the same:
element : '<' Name attribute* '>' content '<' '/' Name '>'
So it will perfectly match
<boo>text</bar>
Is Antlr4 grammar itself not the right place to restrict the "Name" to be the same on both sides of "content"? Then the right way to do it is to use listener/visitor to report that sort of inconsistency?