[jdom-interest] XPATH using JDOM returns null???

Anand, Rajesh Rajesh_Anand at ml.com
Fri Jul 15 10:40:04 PDT 2005


     You are absolutely right about the missing end tag. It was an error
of copy & paste. 
 
    However, what can I do with namespace as this is sent from another
system.
 
    Any Ideas???
 
 

Rajesh Anand 
Email:Rajesh_anand at ml.com 

	-----Original Message-----
	From: Kevin L. Cobb [mailto:kevin.cobb at emergint.com] 
	Sent: 15 July 2005 16:59
	To: Anand, Rajesh
	Subject: RE: [jdom-interest] XPATH using JDOM returns null???
	
	
	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.

	 
	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. 
	 
	 
	 
  _____  

	From: jdom-interest-bounces at jdom.org
[mailto:jdom-interest-bounces at jdom.org] On Behalf Of Anand, Rajesh
	Sent: Friday, July 15, 2005 10:57 AM
	To: jdom-interest at jdom.org
	Subject: [jdom-interest] XPATH using JDOM returns null???
	
	

	        Folks, 

	        I'm parsing an XML file using the following snippet.. 

	        XPath xpath =
XPath.newInstance("/FIXML/Batch/TrdCaptRpt"); 
	                List nodelist = xpath.selectNodes(doc); 
	                Iterator nd = nodelist.iterator(); 
	                while (nd.hasNext()){ 
	                Element ndele = (Element) nd.next(); 
	                fix.listElements(ndele); 
	                } 


	        This is the xml snip... 

	        - <FIXML r="20030618" s="20040109" v="4.4" xr="FIA"
xv="1" xmlns="http://www.fixprotocol.org/FIXML-4-4"> 
	- <Batch> 
	- <TrdCaptRpt RptID="29770863" PrevlyRpted="N" LastQty="1"
LastPx="156.4" TrdDt="2005-07-13" TransTyp="0" RptTyp="2" TrdTyp="0"
MtchID="0043025" BizDt="2005-07-13" MtchStat="0"> 

	<Instrmt Sym="VX" ID="VX" Src="8" CFI="FFICSX" MMY="200602"
MatDt="2006-02-15" Mult="100" Exch="XCBF" /> 
	- <RptSide Side="1" InptDev="MR" Ccy="USD" PosEfct="O"> 
	<Pty ID="OCC" R="21" /> 
	- <Pty ID="00299" R="1"> 
	<Sub ID="C" Typ="26" /> 
	</Pty> 
	<Pty ID="PJZ" R="2" /> 
	</RptSide> 
	- <RptSide Side="2" InptDev="MR" Ccy="USD" PosEfct="C"> 
	<Pty ID="OCC" R="21" /> 
	- <Pty ID="00643" R="18"> 
	<Sub ID="C" Typ="26" /> 
	</Pty> 
	<Pty ID="TM1" R="26" /> 
	</RptSide> 
	</TrdCaptRpt> 


	        Why does nodelist returns NULL??? 

	        Thanks for your help in advance. 

	        

	Rajesh Anand 
	Email:Rajesh_anand at ml.com 

  _____  

	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. Click here
<http://www.ml.com/email_terms/> for important additional terms relating
to this e-mail.     http://www.ml.com/email_terms/
  _____  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20050715/63a8d080/attachment.htm


More information about the jdom-interest mailing list