One embodiment of the present invention provides a system that facilitates
creating a hierarchical model from a programming language file that
includes components. The system operates by obtaining a component from
the programming language file. Upon obtaining the component, the system
passes an encoder to the component and requests that the component encode
itself using the encoder, thereby causing the encoder to generate
elements in the hierarchical model. Each element includes an attribute
that identifies the component, thereby allowing the component to be
subsequently identified by referencing the attribute in the corresponding
element in the hierarchical model.