On Sat, Jun 20, 2009 at 4:45 AM, Andreas Veithen
<andreas.veit...@gmail.com>wrote:

> StAXOMBuilder actually already creates an OMDocument (which can be
> retrieved by the getDocument method). The important thing is that we
> need to make sure that the Axiom tree is fully built before closing
> the input stream. I guess that the detach method is used because it
> has the side effect of fully building the element and because
> OMDocument has no method to build the entire tree (see WSCOMMONS-479).
>
> This gives us two solutions:
>
> - Use StAXOMBuilder#getDocument and iterate over its children to make
> sure the document is fully built.
> - Continue to use "detach" and add the element to a new document, as
> you suggested. Note that you should not use OMDocumentImpl directly,
> but create it using the OMFactory.


+1 for this second approach.

Ruwan

>
>
> Andreas
>
> On Fri, Jun 19, 2009 at 09:30, indika kumara<indika.k...@gmail.com> wrote:
> > Devs
> >
> > $subject is due to we do  'detach()'  on picked resource OMElement .
> > If I add detached element to a OMDocument as a child, it works
> >
> > Existing code  SImpleURLRegistry
> >
> > result.detach();
> > inputStream.close();
> >
> >
> > Modified code
> >
> > result.detach();
> > OMDocumentImpl omDocument = new OMDocumentImpl();
> > omDocument.addChild(result);
> > inputStream.close();
> >
> >
> > Are there any best solution other than what I did ?  I haven't deep
> > AXIOM knowledge?  Could anyone help me?
> >
> > Thanks
> > Indika
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@synapse.apache.org
> > For additional commands, e-mail: dev-h...@synapse.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@synapse.apache.org
> For additional commands, e-mail: dev-h...@synapse.apache.org
>
>


-- 
Ruwan Linton
Senior Software Engineer & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ru...@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Reply via email to