Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.
I would like to delete an element Person with the Lastname “AAA”. If i use Rootelement.remove(Person), all Person elements will be deleted. Could someone please help me? Thanks a lot.Butterfly…TQuery query = TQuery.newInstance( “/” );TResponse response = accessor.query(query);try{ TXMLObjectIterator ti = response.getXMLObjectIterator() ; while (ti.hasNext()) { try{ TXMLObject next = ti.next() ; ??? … AAA BBB 40 CCC DDD 50
Hi,This can be accomplished using DOM methods. One way is to obtain a node list of Lastname elements, iterate through them and if its value is AAA then remove the parent node (Person). I gather what you have attempted so far is to remove the Person element which will remove that part of the DOM tree from the document. For more information please refer to specific DOM documentation.Hope this helps.Stuart Fyffe-CollinsSoftware AG (UK) Ltd.
Thanks for your reply.I haven’t used DOM method, only JDOM method. But I will try the method you suggested.