I have some legacy data that I want to convert to XML. I've designed
a schema to represent the data in XML form, and I'm trying to figure
out how best to perform the raw->XML conversion. The Java web
services tutorial shows how to use Transformers and SAXSource objects
to perform the conversion in a memory-efficient way, but it requires
that I take responsibility for adherence to the schema myself in how I
generate the XML output. So I thought I'd see what I can do with
JAXB. Marshaling (i.e., converting Java classes based on the schema
to XML) works great for small amounts of data, but I don't think it
will scale well to raw input files that are hundreds of MB in size.
So I'm wondering if there's some way to combine the two approaches:
SAX-oriented event-based generation of output files together with
JAXB-contolled streaming of the output file. Is such a thing
possible?
On the other side of it, once I have the data in XML form, is there a
way to combine event-based parsing with unmarshaling so that I can
read a subset of the XML data into the JAXB-based Java classes?
Thanks,
Sandeep