<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<blockquote
 cite="mid:145c04a0705040229n4ee9728awa797b82d01d829bb@mail.gmail.com"
 type="cite">
  <div>hi,</div>
  <div>i want to traverse a xml file who has 2 namespaces, but i get a
NullPointerException </div>
  <div>the file&nbsp;looks like following:</div>
  <div>&nbsp;</div>
  <div>
  <p
 style="margin: 0cm 0cm 0pt; background: white none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span
 style="color: blue; font-family: Arial;">&lt;</span><span
 style="color: maroon; font-family: Arial;">Envelope</span><span
 style="color: red; font-family: Arial;"> xmlns
  </span><span style="color: blue; font-family: Arial;">="</span><span
 style="font-family: Arial;"><a moz-do-not-send="true"
 href="http://ns.hr-xml.org/2004-08-02">http://ns.hr-xml.org/2004-08-02</a><span
 style="color: blue;">"</span><span style="color: red;"> xmlns:oa</span><span
 style="color: blue;">="</span><a moz-do-not-send="true"
 href="http://www.openapplications.org/oagis">http://www.openapplications.org/oagis</a><span
 style="color: blue;">"</span><span style="color: red;"> xmlns:xsi</span>
  <span style="color: blue;">="</span><a moz-do-not-send="true"
 href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a><span
 style="color: blue;">"&gt;</span></span></p>
  <p
 style="margin: 0cm 0cm 0pt; background: white none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span
 style="color: blue; font-family: Arial;">&nbsp;&lt;moha&gt;</span><span
 style="font-family: Arial;"></span></p>
  <p
 style="margin: 0cm 0cm 0pt; background: white none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span
 style="color: blue; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;jalal
aida="kouider"&gt;</span><span style="font-family: Arial;"></span></p>
  <p
 style="margin: 0cm 0cm 0pt; background: white none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span
 style="color: blue; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;oa:nabil&gt;rabha&lt;/oa:nabil&gt;</span><span
 style="font-family: Arial;"></span></p>
  <p
 style="margin: 0cm 0cm 0pt; background: white none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span
 style="color: blue; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/jalal&gt;</span><span
 style="font-family: Arial;"></span></p>
  <p
 style="margin: 0cm 0cm 0pt; background: white none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span
 style="color: blue; font-family: Arial;">&nbsp;&lt;/moha&gt;</span><span
 style="font-family: Arial;"></span></p>
  <p
 style="margin: 0cm 0cm 0pt; background: white none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span
 style="color: blue; font-family: Arial;">&lt;/</span><span
 style="color: maroon; font-family: Arial;">Envelope&gt;</span></p>
  <p
 style="margin: 0cm 0cm 0pt; background: white none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span
 style="color: maroon; font-family: Arial;"></span>&nbsp;</p>
  <p
 style="margin: 0cm 0cm 0pt; background: white none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span
 style="color: maroon; font-family: Arial;">root.getChild("moha",root.getNameSpace).getChild("jalal",<font
 color="#800000">root.getNameSpace</font>
).getChild("nabil",<font color="#800000">root.getNameSpace</font>)&nbsp;
return &agrave; null</span></p>
  </div>
</blockquote>
But the nabil element isn't in the same namespace as root in the
document above.<br>
Try <span style="color: maroon; font-family: Arial;">root.getChild("moha",root.getNameSpace()).getChild("jalal",<font
 color="#800000">root.getNameSpace</font>()
).getChild("nabil",<font color="#800000"> Namespace.getNamespace</font>("</span><span
 style="font-family: Arial;"><a moz-do-not-send="true"
 href="http://www.openapplications.org/oagis">http://www.openapplications.org/oagis</a><span
 style="color: blue;">"</span></span><span
 style="color: maroon; font-family: Arial;">))</span>
</body>
</html>