<!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 looks like following:</div>
<div> </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;"><</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;">"></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;"> <moha></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;"> <jalal
aida="kouider"></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;">
<oa:nabil>rabha</oa:nabil></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;"> </jalal></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;"> </moha></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;"></</span><span
style="color: maroon; font-family: Arial;">Envelope></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> </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>)
return à 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>