You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Robert Marshall <ro...@san.rr.com> on 2000/06/29 08:25:43 UTC

DocumentImpl removeChild

Hi,

When I try to remove an element from a document that was created using a
DOMParser
I get the error "DocumentImpl Not Found"


I have an instance of DocumentImpl that I get from a parser like this:

    doc   = (DocumentImpl)parser.getDocument();

I then look up an element in the doc then try to remove it using removeChild
but this
fails.

            DeepNodeListImpl users =
				(DeepNodeListImpl)doc.getElementsByTagName("user");

            for (int user = 0; user < users.getLength(); user++)
            {
               Element userElement = (Element)users.item(user);
               String userId = userElement.getAttribute(MsgDefs.attrUserId);
               if (userId.equals(msgData.m_userId))
               {
////////////////////////////////////////////////////////////////////////////
//////
                  doc.removeChild(userElement); // this fails
!!!!!!!!!!!!!!!!!!!!!
////////////////////////////////////////////////////////////////////////////
//////
                  break;
               }
            }

Is this the normal behavior for a Document created by a parser???

Any suggestions would be appreciated.

Thanks,

Rob