Thanx..i was not knowing this. I was breaking brains why the newly created
nodes are not being recognized. Is this a bug ?why doesn't xerces
automatically call putIdentifier? I have a major problem. My application
needs two xml nodes to be swapped. Once i swap the node it's not being
recognized by my XQL engine. if i give a query
XQL.execute("//node[@rmrid='rmridvalue']",docNode)..it gives me null. if i
give XQL.execute("//node[@rmrid='rmridvalue']",createdNode)..it works fine..
Is this b'coz of the same behaviour as xerces?
thanks,
kusuma
----- Original Message -----
From: "Evert Hoff" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 9:45 AM
Subject: Re: AW: DOMException
> >thanks a lot. It worked..One more question..How to define an attribute as
> >type ID to use the method getElementsByID() in the Document
> >thanks,
> >kusuma
> >
> If you are not busy adding new nodes to the document, then it works if
> you define the attribute in the DTD as ID. But, if you are busy adding
> new nodes and want to find the new nodes by their IDs, then you must do
> the following:
>
> Element newNode = doc.createElement("name");
> DocumentImpl docImpl = (DocumentImpl)doc;
> newNode.setAttribute( "id", "new-node-id" );
> newNode.setAttribute( "first", "new first name" );
> Node parent = node.getParentNode();
> parent.appendChild( newNode );
> docImpl.putIdentifier( "new-node-id", newNode ); // <<----- This
> is what defines the new attribute as an ID
> Element foundNode = doc.getElementById( "new-node-id" );
>
> This is because the ID map is not updated when attributes are set.
> Ideally, Xerces should automatically check whether an attribute is of
> type ID and then call putIdentifier.
>
> Evert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]