It currently doesn't have any explicit support for fragment marshalling,
but like you said, you can easily write an XMLFilter that blocks
start|endDocument. In your case, you just need to:
Marshaller m = jc.createMarshaller();
m.marshal(myElem, new FragmentFilter(contentHandler));
where FragmentFilter is:
class FragmentFilter extends XMLFilterImpl {
FragmentFilter( ContentHandler handler ) {
setContentHandler(handler);
}
public void startDocument() {}
public void endDocument() {}
}
Perhaps this could be another example.
regards,
--
Kohsuke KAWAGUCHI 408-276-7063 (x17063)
Sun Microsystems kohsuke.kawaguchi_at_sun.com