Re: append to xml

Mattias Jiderhamn <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
> hi,
> i want to traverse a xml file who has 2 namespaces, but i get a
> NullPointerException
> the file looks like following:
>  
>
> <Envelope xmlns ="http://ns.hr-xml.org/2004-08-02"
> xmlns:oa="http://www.openapplications.org/oagis" xmlns:xsi
> ="http://www.w3.org/2001/XMLSchema-instance">
>
>  <moha>
>
>         <jalal aida="kouider">
>
>                  <oa:nabil>rabha</oa:nabil>
>
>         </jalal>
>
>  </moha>
>
> </Envelope>
>
>  
>
> root.getChild("moha",root.getNameSpace).getChild("jalal",root.getNameSpace
> ).getChild("nabil",root.getNameSpace)  return à null
>
But the nabil element isn't in the same namespace as root in the
document above.
Try
root.getChild("moha",root.getNameSpace()).getChild("jalal",root.getNameSpace()
).getChild("nabil",
Namespace.getNamespace("http://www.openapplications.org/oagis"))

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.