You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Jean-Michel PATER <pa...@cogenit.fr> on 2006/12/20 15:27:03 UTC

[AXIOM] Uncomment an OMElement

Hi all,

I would like to edit an XML file and uncomment an element. For this I 
used the following code :
>                     OMNode child = elt.getFirstOMChild();
>                     while(child != null) {
>                         if(child instanceof OMComment) {
>                             OMComment omc = (OMComment)child;
>                                 OMElement doc = 
> builder.getDocumentElement();
>                                     try {
>                                     doc = (OMElement)doc.detach();
>                                     elt.addChild(doc);
>                                     child.insertSiblingAfter(doc);
>                                                                       
> System.out.println(elt.toString());
On the elt.toString() I've got a outOfMemory exception :
> Unhandled event loop exception
> Reason:
> Java heap space
Does somebody have an idea on how to proceed to uncomment an OMNode ?

Thanks

-- 
Cogenit                http://www.xcarecrows.com

53 rue Sainte Anne                       
75002 Paris                              



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


Re: [AXIOM] Uncomment an OMElement

Posted by Sameera Madushan <sa...@gmail.com>.
Hi

Attach your complete code,

Sameera

On 12/20/06, Jean-Michel PATER <pa...@cogenit.fr> wrote:
>
> Hi all,
>
> I would like to edit an XML file and uncomment an element. For this I
> used the following code :
> >                     OMNode child = elt.getFirstOMChild();
> >                     while(child != null) {
> >                         if(child instanceof OMComment) {
> >                             OMComment omc = (OMComment)child;
> >                                 OMElement doc =
> > builder.getDocumentElement();
> >                                     try {
> >                                     doc = (OMElement)doc.detach();
> >                                     elt.addChild(doc);
> >                                     child.insertSiblingAfter(doc);
> >
> > System.out.println(elt.toString());
> On the elt.toString() I've got a outOfMemory exception :
> > Unhandled event loop exception
> > Reason:
> > Java heap space
> Does somebody have an idea on how to proceed to uncomment an OMNode ?
>
> Thanks
>
> --
> Cogenit                http://www.xcarecrows.com
>
> 53 rue Sainte Anne
> 75002 Paris
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: commons-dev-help@ws.apache.org
>
>