1. A method comprising generating an automaton for validating an XML document, including: a first step of reading a document type definition of the XML Document; a second step of generating a binary tree automaton from said document type definition; and a third step of determining and further minimizing said binary tree automaton, and generating a minimum deterministic binary tree automaton.