Hi, Mark + Dennis: I would second this request as I am looking at doing something quite similar right now. My use case is somewhat different though. I am writing a custom marshaller/unmarshaller to handle arbitrary XML, not to DOM, but to String (because in some cases it is intended to be persisted and not processed immediately).
In XML schema terms this is a case of an xsd:any element. Essentially providing a mapping at some point in an XML document that can permit _any_ XML content of unknown structure, but, preserve this across the binding boundary. The custom unmarshaller creates an internal marshaller to output the arbitrary XML to String (this part is complete), then the (hopeful) plan on marshalling would be to simply inject the pre-marshalled XML String directly into the output stream. The writer should manange the encoding required. So, the getOutputStream() method suggested by Mark would seem to be useful for this case as well. I realize this might seem somewhat unorthodox, but, isn't JiBX designed for efficiency ;-) This approach would likely be the most efficient approach, albeit in certain limited circumstances (please note that we are also using the DomElementMapper as well where DOM is more appropriate). Another use of this method might be to support the aggregation or consolidation of multiple fragments into a single document -- perhaps they could be funnelled into a single output stream in this way. I'm interested to hear what you think. Regards, ...Leif P.S. Mark, you seem to be doing dynamic marshalling from multiple binding files which sounds very useful in light of an earlier conversation I had with Dennis about looking up a mapping Class from an element QName. Are you writing a general JiBX access layer that can locate a mapping anywhere on the classpath ~ or something similar? This would remove the requirement to provide the Class directly to the marshal/unmarshal method invocations? -------------------------------------------------- Mark Wutka wrote: Tue, 01 Nov 2005 12:00:55 -0800 Hi Dennis, I think I run into the same problem this way that I do with my temporary solution. That is, in order to create a new StreamWriterBase and make it write to the current output stream, I need to be able to fetch the current output stream. In my current solution, with the added getOutputStream in StreamWriterBase, all I have to do is: OutputStream out = ((StreamWriterBase) writer).getOutputStream(); newMCtx.marshalDocument(o, "UTF-8", null, out); I was hoping that you might be able to expose getOutputStream officially so I am not trying to maintain my own fork of the code. Mark ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ jibx-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users
