The method for reformatting a tag-based code containing at least one corresponding
beginning and end tag pair generally includes locating each beginning and end tag
of the tag-based code, separating distinct tags and data associated therewith into
separate lines, maintaining a tag structure state machine for determining a tag
structure corresponding to each line, and delineating each line with a representation
of a tag structure corresponding to the line based on the state-machine of the
tag structure.