Question: Can anyone explain to me why it is not possible to define an XML-like element using a context-free grammar (Chomsky, EBNF or syntax charts)?

Answer: 
[This thread](https://math.stackexchange.com/a/722772) says:

> 
> XML is a language defined by SGML, which is a restricted form of context free grammar (essentially a Dyck language with many types of parentesis)
> 
> 
>
Actually, XML is a context-free language that can be parsed with anything capable of parsing CFLs. CFLs are Chomsky Level 2.

It's actually already been done. [W3](https://www.w3.org/TR/REC-xml/#sec-notation) uses EBNF notation to "completely describe" (or define) XML:

> 
> `symbol ::= expression`
> 
> 
> 

A subset of XML, known as the terminals (the "leaves" of the tree,) it is possible to parse with simple regular expressions. I'm not even talking about modern regexes (such as those found in Perl, PCRE, and even Java).

> 
> Symbols are written with an initial capital letter if they are the start symbol of a **regular language**, otherwise with an initial lowercase letter.
> 
> 
> 

There's also a [website](http://www.rpatk.net/web/en/parsexml.php) that uses BNF to parse XML. (BNF is a little more confusing to read, especially when dealing with XML, because its syntax uses angle brackets, too.)