<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2523" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=141020618-15072005><FONT face=Arial
color=#0000ff size=2>I think the problem is (please someone educate me if I'm
wrong) that the namepsace declaration in the FIXML element is referring to the
default namespace and in JDOM XPATH, there is no such thing as a default
namespace. This is from the JDOM API . . . </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=141020618-15072005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=141020618-15072005> In
XPath, there is no such thing as a 'default namespace'. The empty prefix
<B>always</B> resolves to the empty namespace URI.</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=141020618-15072005></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=141020618-15072005></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Anand, Rajesh [mailto:Rajesh_Anand@ml.com]
<BR><B>Sent:</B> Friday, July 15, 2005 1:40 PM<BR><B>To:</B> Kevin L. Cobb;
jdom-interest@jdom.org<BR><B>Subject:</B> RE: [jdom-interest] XPATH using JDOM
returns null???<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=855313917-15072005> You are absolutely right about
the missing end tag. It was an error of copy & paste.
<DIV><SPAN class=459335416-15072005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=459335416-15072005> <FONT face=Arial
color=#0000ff size=2>However, what can I do with namespace as this is sent from
another system.</FONT></SPAN></DIV>
<DIV><SPAN class=459335416-15072005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=459335416-15072005> <FONT face=Arial
color=#0000ff size=2>Any Ideas???</FONT></SPAN></DIV></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV><!-- Converted from text/rtf format -->
<P><SPAN lang=en-gb><B><I><FONT face=Arial size=2>Rajesh
Anand</FONT></I></B></SPAN> <BR><SPAN lang=en-gb><B><FONT face=Arial
size=2>Email:Rajesh_anand@ml.com</FONT></B></SPAN> </P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Kevin L. Cobb
[mailto:kevin.cobb@emergint.com] <BR><B>Sent:</B> 15 July 2005
16:59<BR><B>To:</B> Anand, Rajesh<BR><B>Subject:</B> RE: [jdom-interest] XPATH
using JDOM returns null???<BR><BR></FONT></DIV>
<DIV dir=ltr align=left><SPAN class=592442815-15072005><FONT face=Arial
color=#0000ff size=2>Assuming your XML snippet has a cut-and-paste error,
missing 'Batch' and 'FIXML' end tags, I ran it in my app and the nodeList does
not come back NULL. It does, however, come back empty. If you take out the
namespace declaration in the root node, FIXML, it works as expected.
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=592442815-15072005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=592442815-15072005><FONT face=Arial
color=#0000ff size=2>I'm pretty sure the problem is that this changes the
namespace of the element, FIXML, and this is why the XPATH does not see it. I
can't tell you what to do to fix it though. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=592442815-15072005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=592442815-15072005></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=592442815-15072005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr align=left><FONT face=Tahoma size=2><B>From:</B>
jdom-interest-bounces@jdom.org [mailto:jdom-interest-bounces@jdom.org] <B>On
Behalf Of </B>Anand, Rajesh<BR><B>Sent:</B> Friday, July 15, 2005 10:57
AM<BR><B>To:</B> jdom-interest@jdom.org<BR><B>Subject:</B> [jdom-interest]
XPATH using JDOM returns null???<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><!-- Converted from text/rtf format -->
<P> <FONT face=Arial
size=2>Folks,</FONT> </P>
<P> <FONT face=Arial size=2>I'm
parsing an XML file using the following snippet..</FONT> </P>
<P> <FONT
face="Times New Roman">XPath xpath =
XPath.newInstance("/FIXML/Batch/TrdCaptRpt");</FONT>
<BR>
<FONT face="Times New Roman">List
nodelist = xpath.selectNodes(doc);</FONT>
<BR>
<FONT
face="Times New Roman">Iterator nd = nodelist.iterator();</FONT>
<BR>
<FONT face="Times New Roman">while
(nd.hasNext()){</FONT> <BR>
<FONT
face="Times New Roman">Element ndele = (Element) nd.next();</FONT>
<BR>
<FONT
face="Times New Roman">fix.listElements(ndele);</FONT>
<BR>
<FONT
face="Times New Roman">}</FONT> </P><BR>
<P> <FONT face=Arial size=2>This is
the xml snip…</FONT> </P>
<P> <A href=""><U><FONT
face="Times New Roman" color=#0000ff>-</FONT></U></A><FONT
face="Times New Roman"> <FIXML r="<B>20030618</B>" s="<B>20040109</B>"
v="<B>4.4</B>" xr="<B>FIA</B>" xv="<B>1</B>" xmlns="<A
href="http://www.fixprotocol.org/FIXML-4-4">http://www.fixprotocol.org/FIXML-4-4</A>">
</FONT><BR><A href=""><U><FONT face="Times New Roman"
color=#0000ff>-</FONT></U></A><FONT face="Times New Roman"> <Batch>
</FONT><BR><A href=""><U><FONT face="Times New Roman"
color=#0000ff>-</FONT></U></A><FONT face="Times New Roman"> <TrdCaptRpt
RptID="</FONT><B><FONT face="Times New Roman">29770863</FONT></B><FONT
face="Times New Roman">" PrevlyRpted="</FONT><B><FONT
face="Times New Roman">N</FONT></B><FONT face="Times New Roman">"
LastQty="</FONT><B><FONT face="Times New Roman">1</FONT></B><FONT
face="Times New Roman">" LastPx="</FONT><B><FONT
face="Times New Roman">156.4</FONT></B><FONT face="Times New Roman">"
TrdDt="</FONT><B><FONT face="Times New Roman">2005-07-13</FONT></B><FONT
face="Times New Roman">" TransTyp="</FONT><B><FONT
face="Times New Roman">0</FONT></B><FONT face="Times New Roman">"
RptTyp="</FONT><B><FONT face="Times New Roman">2</FONT></B><FONT
face="Times New Roman">" TrdTyp="</FONT><B><FONT
face="Times New Roman">0</FONT></B><FONT face="Times New Roman">"
MtchID="</FONT><B><FONT face="Times New Roman">0043025</FONT></B><FONT
face="Times New Roman">" BizDt="</FONT><B><FONT
face="Times New Roman">2005-07-13</FONT></B><FONT face="Times New Roman">"
MtchStat="</FONT><B><FONT face="Times New Roman">0</FONT></B><FONT
face="Times New Roman">"> </FONT></P>
<P><FONT face="Times New Roman"><Instrmt Sym="</FONT><B><FONT
face="Times New Roman">VX</FONT></B><FONT face="Times New Roman">"
ID="</FONT><B><FONT face="Times New Roman">VX</FONT></B><FONT
face="Times New Roman">" Src="</FONT><B><FONT
face="Times New Roman">8</FONT></B><FONT face="Times New Roman">"
CFI="</FONT><B><FONT face="Times New Roman">FFICSX</FONT></B><FONT
face="Times New Roman">" MMY="</FONT><B><FONT
face="Times New Roman">200602</FONT></B><FONT face="Times New Roman">"
MatDt="</FONT><B><FONT face="Times New Roman">2006-02-15</FONT></B><FONT
face="Times New Roman">" Mult="</FONT><B><FONT
face="Times New Roman">100</FONT></B><FONT face="Times New Roman">"
Exch="</FONT><B><FONT face="Times New Roman">XCBF</FONT></B><FONT
face="Times New Roman">" /> </FONT><BR><A href=""><U><FONT
face="Times New Roman" color=#0000ff>-</FONT></U></A><FONT
face="Times New Roman"> <RptSide Side="</FONT><B><FONT
face="Times New Roman">1</FONT></B><FONT face="Times New Roman">"
InptDev="</FONT><B><FONT face="Times New Roman">MR</FONT></B><FONT
face="Times New Roman">" Ccy="</FONT><B><FONT
face="Times New Roman">USD</FONT></B><FONT face="Times New Roman">"
PosEfct="</FONT><B><FONT face="Times New Roman">O</FONT></B><FONT
face="Times New Roman">"> </FONT><BR><FONT face="Times New Roman"><Pty
ID="</FONT><B><FONT face="Times New Roman">OCC</FONT></B><FONT
face="Times New Roman">" R="</FONT><B><FONT
face="Times New Roman">21</FONT></B><FONT face="Times New Roman">" />
</FONT><BR><A href=""><U><FONT face="Times New Roman"
color=#0000ff>-</FONT></U></A><FONT face="Times New Roman"> <Pty
ID="</FONT><B><FONT face="Times New Roman">00299</FONT></B><FONT
face="Times New Roman">" R="</FONT><B><FONT
face="Times New Roman">1</FONT></B><FONT face="Times New Roman">">
</FONT><BR><FONT face="Times New Roman"><Sub ID="</FONT><B><FONT
face="Times New Roman">C</FONT></B><FONT face="Times New Roman">"
Typ="</FONT><B><FONT face="Times New Roman">26</FONT></B><FONT
face="Times New Roman">" /> </FONT><BR><FONT
face="Times New Roman"></Pty> </FONT><BR><FONT
face="Times New Roman"><Pty ID="</FONT><B><FONT
face="Times New Roman">PJZ</FONT></B><FONT face="Times New Roman">"
R="</FONT><B><FONT face="Times New Roman">2</FONT></B><FONT
face="Times New Roman">" /> </FONT><BR><FONT
face="Times New Roman"></RptSide> </FONT><BR><A href=""><U><FONT
face="Times New Roman" color=#0000ff>-</FONT></U></A><FONT
face="Times New Roman"> <RptSide Side="</FONT><B><FONT
face="Times New Roman">2</FONT></B><FONT face="Times New Roman">"
InptDev="</FONT><B><FONT face="Times New Roman">MR</FONT></B><FONT
face="Times New Roman">" Ccy="</FONT><B><FONT
face="Times New Roman">USD</FONT></B><FONT face="Times New Roman">"
PosEfct="</FONT><B><FONT face="Times New Roman">C</FONT></B><FONT
face="Times New Roman">"> </FONT><BR><FONT face="Times New Roman"><Pty
ID="</FONT><B><FONT face="Times New Roman">OCC</FONT></B><FONT
face="Times New Roman">" R="</FONT><B><FONT
face="Times New Roman">21</FONT></B><FONT face="Times New Roman">" />
</FONT><BR><A href=""><U><FONT face="Times New Roman"
color=#0000ff>-</FONT></U></A><FONT face="Times New Roman"> <Pty
ID="</FONT><B><FONT face="Times New Roman">00643</FONT></B><FONT
face="Times New Roman">" R="</FONT><B><FONT
face="Times New Roman">18</FONT></B><FONT face="Times New Roman">">
</FONT><BR><FONT face="Times New Roman"><Sub ID="</FONT><B><FONT
face="Times New Roman">C</FONT></B><FONT face="Times New Roman">"
Typ="</FONT><B><FONT face="Times New Roman">26</FONT></B><FONT
face="Times New Roman">" /> </FONT><BR><FONT
face="Times New Roman"></Pty> </FONT><BR><FONT
face="Times New Roman"><Pty ID="</FONT><B><FONT
face="Times New Roman">TM1</FONT></B><FONT face="Times New Roman">"
R="</FONT><B><FONT face="Times New Roman">26</FONT></B><FONT
face="Times New Roman">" /> </FONT><BR><FONT
face="Times New Roman"></RptSide> </FONT><BR><FONT
face="Times New Roman"></TrdCaptRpt></FONT> </P><BR>
<P> <FONT face=Arial size=2>Why does
nodelist returns NULL???</FONT> </P>
<P> <FONT face=Arial size=2>Thanks
for your help in advance.</FONT> </P>
<P> </P>
<P><B><I><FONT face=Arial size=2>Rajesh Anand</FONT></I></B> <BR><B><FONT
face=Arial size=2>Email:Rajesh_anand@ml.com</FONT></B> </P></DIV>
<DIV>
<HR color=gray>
</DIV>
<DIV>If you are not an intended recipient of this e-mail, please notify the
sender, delete it and do not read, act upon, print, disclose, copy, retain or
redistribute it. <A href="http://www.ml.com/email_terms/">Click here </A>for
important additional terms relating to this e-mail. <A
href="http://www.ml.com/email_terms/">http://www.ml.com/email_terms/</A></DIV>
<DIV>
<HR color=gray>
</DIV></BLOCKQUOTE></BODY></HTML>