A method and system for modifying program applications of a legacy
computer system to directly output data as XML using a DOM instance,
models the legacy computer system, maps the model to an XML schema and
automatically modifies one or more applications to directly output XML
formatted data from an internally constructed DOM instance in cooperation
with a writer engine. The writer engine allows for an arbitrary number of
contexts to be simultaneously active and builds a complete DOM instance
by using the multiple contexts to buffer output data. The writer engine
directly loads XML schema information to construct and output DOM
instances in accordance with the schema and subject to further
transformation by XSLT stylesheets.