What are the best alternatives for “typing” (nnn, aaa, length 0-5, etc.) elements?
XML has no typing mechanisms. ISO 10744, which defines extensions to SGML in an annex, has a formal method for defining lexical types based on a formal definition of a lexical model and an attribute called lextype. (There is also an informal mechanism based on the use of lextype comments, but this won’t work in XML because comments are not allowed within XML declarations.) However, one does not need to use these standardized methods, and there may be good reasons why one should not do so. Consider the following definitions: <!ATTLIST element-y X12-REPR CDATA #FIXED "AN/2/30" > This associates a fixed attribute, unique to the XML-EDI namespace, which provides a definition of the EDI datatype of element-y. Using this technique, we can develop an ANSI ASC X12-compliant method for checking the validity of ANSI ASC X12 messages and develop a general purpose program for lexical checking of ANSI ASC X12 messages that can be shared.