I am writing a book on structured writing and I am trying hard to break the association people have between structured writing and XML by highlighting the many other markup languages that are used to do various kinds of structured writing.
I am attempting to describe each of these languages in terms of their ability to support certain structured writing aids such as extensibility and constraint. By extensibility I mean the ability to add new structures to the language. By constraint I mean the ability to restrict what can go where and specify restricted hierarchical structures. In XML, these things are both performed declaratively by schema languages.
It is clear that Tex and LaTeX are extensible programmatically through macros. I can't find any mention of any declarative approach.
What I have not been able to figure out is whether macros provide any kind of constraint mechanism. So my question is, is there a constraint mechanism in TeX or LaTeX that provide functionality similar to constraints one can impose in an XML schema?