<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#8eaab0>
<DIV><SPAN class=140173018-19112002><FONT face=Arial color=#0000ff size=2>Use
the XPath features in jdom.</FONT></SPAN></DIV>
<DIV><SPAN class=140173018-19112002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140173018-19112002><FONT face=Arial color=#0000ff size=2>XPath
idXpath = new XPath("//*[@id=5]");</FONT></SPAN></DIV>
<DIV><SPAN class=140173018-19112002><FONT face=Arial color=#0000ff
size=2>Element id5Element =
idXpath.selectSingleNode(myDocument);</FONT></SPAN></DIV>
<DIV><SPAN class=140173018-19112002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140173018-19112002><FONT face=Arial color=#0000ff size=2>// Now
remove the element.</FONT></SPAN></DIV>
<DIV><SPAN class=140173018-19112002><FONT face=Arial color=#0000ff
size=2>id5Element.getParent().remove(id5Element);</FONT></SPAN></DIV>
<DIV><SPAN class=140173018-19112002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Stefanos Kaklamanis
[mailto:stefka@gnt.gr]<BR><B>Sent:</B> Monday, November 18, 2002 8:13
AM<BR><B>To:</B> JDOM-interest list<BR><B>Subject:</B> [jdom-interest] XPath
and JDOM<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I want to get a specific element ( where
attribute id =5 ) from an JDOM document and edit/remove it from the
document.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any suggestion about solutions and
tools?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2>Stefan</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>PS. I already have a look at Jaxen and SAXPath,
but I could take what i want.</FONT></DIV></BLOCKQUOTE></BODY></HTML>