The invention discloses an ASTERIX message parsing code generation method based on XML. The ASTERIX message parsing code generation method based on XML is characterized by comprising the following four steps: step 1, configurating the various parameters of the communication protocol according to the ICD and saving as a XML file; Step 2, reading the XML configuration file obtained in the step 1, and parsing to generate a memory object which can be recognized by the computer program; step 3, generating a corresponding data structure file according to the memory object obtained in the step 2; and step 4, generating a corresponding parsing code file according to the memory object obtained in the step 2. The invention is applicable to different types and versions of protocol and easy to modify; according to the invention, the message parsing program which can be run is generated by means of the XML configuration file, therefore, the ASTERIX message parsing code can be generated by means of the ASTERIX message parsing code generation method based on XML disclosed by the invention with the only need for the user to writie the configuration file according to the ICD. The scheme provided by the invention greatly improves the efficiency of the original work; and the analysis is partly modularized by the scheme, therefore, the scheme provided by the invention conforms to the modular tendency for problem solving in modern times.