You can get a SAX ContentHandler or DocumentHandler from the Castor
Unmarshaller.

The Unmarshaller#createHandler method will return an UnmarshalHandler
which is a ContentHandler and DocumentHandler, so just cast it to
whichever you prefer.

--Keith


Mark Shifman wrote:
> 
> Hi;
> I am just starting to use castor and xalan and I was wondering if
> someone has some example code showing how to pipe
> a transformed xml into the unmarshaller.
> 
> Below is the code I am using, however I write a temporary file,
> simple.xml, and the read the temporary file for unmarshaling.
> 
>     TransformerFactory tFactory = TransformerFactory.newInstance();
>     Transformer transformer = tFactory.newTransformer(new
> StreamSource("mytransform.xsl"));
>     transformer.transform(new StreamSource("complex.xml"), new
> StreamResult(new FileOutputStream("simple.xml")));
> 
>     Mapping mapping = new Mapping();
>     mapping.loadMapping("mapping.xml");
> 
>     Unmarshaller unmar = new Unmarshaller(mapping);
>      myObject theResults = (myObject) unmar.unmarshal(new
> InputSource(new FileReader("simple.xml")));
> 
> How do I create a StreamResult/SaxResult that can be directly eaten by
> the unmarshaller without writting a temporary file?
> 
> Thanks in advance.
> 
> mas
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-user



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to