Sree Harsha wrote:
Thanks a lot once again, but
It not executing the statement ( I think it is giving rise to runtime
errors),
LNodeFileAddedElement->removeChild(LNodeAddedFileList->item(1));
Are you sure that LNodeFileAddedElement is not NULL? Are you sure that
LNodeAddedFileList has at least 2 elements (i.e. that "Added" has at
least two "Path" child elements)? Have you tried running your program
inside a debugger to actually see what it's happening?
Alberto
On 3/17/08, *Alberto Massari* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Sree Harsha wrote:
> Thanks,
> <quote>The
> node will be actually removed from memory when the LXMLDoc
object will
> be deleted.</quote>
> Does this mean that the removed node will be present in
> LNodeFileAddedElement even after i do this
> LNodeFileAddedElement->removeChild(LNodeAddedFileList->item(1));
> ???
> Will the node be present if i start processing LNodeFileAddedElement
> again???
No, the node will not be in the tree anymore, but the pointer to
it will
still be valid (e.g. you can attach it to a different element of the
same tree).
Also, be careful that the list returned by getElementsByTagName is
"live" and will immediately reflect the removal of the node (i.e.
after
removeChild, item(1) will return what was previously accessed by
item(2))
Alberto
>
> On 3/17/08, *Alberto Massari* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>> wrote:
>
> harshabi wrote:
> > Hello all,
> > How can i delete(Remove) a node in the memory?? should i use a
> DOMNodelist
> > or DOMElement...For example consider the following snippet...
> > xercesc::DOMDocument* LXMLDoc = Lparser_.getDocument() ;
> >
> >
> > xercesc::DOMNodeList*
> >
LNodeAddedList=LXMLDoc->getElementsByTagName(XercesString("Added"));
> > xercesc::DOMNode*
> LNodeFileAddedElement=(DOMNode*)(LNodeAddedList->item(0));
> >
> > xercesc::DOMNodeList*
> >
>
LNodeAddedFileList=((DOMElement*)LNodeFileAddedElement)->getElementsByTagName(XercesString("Path"));
> >
> > Let us say that i dont want the 2nd item in the
> LNodeAddedFileList (ie
> > LNodeAddedFileList->item(2)) how can i remove it??? will it
> affect the
> > DOMTree constructed (that is actually the effect i
want)... Help
> me out with
> > this..
> >
> First of all, item(2) retrieves the third "Path" item, not
the second
> one. If you want to remove that node from the DOM tree, you
can use
>
LNodeFileAddedElement->removeChild(LNodeAddedFileList->item(1)). The
> node will be actually removed from memory when the LXMLDoc
object will
> be deleted.
>
> Alberto
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>
> For additional commands, e-mail:
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>
>
>
>
>
> --
> Regards
> Sree Harsha Vardhana S.N
> "When you want something, all the universe conspires in helping
you to
> achieve it."
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
--
Regards
Sree Harsha Vardhana S.N
"When you want something, all the universe conspires in helping you to
achieve it."
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]