You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by ma...@cnedi69.cnafmail.fr on 2001/06/06 10:35:34 UTC

NullPointerException

Hi,

I'm trying to create a new document from the extraction of an element of an
existing Document :

public Document Decomposer(Document docXML)
     {
          Document XMLElementary=null;
          NodeList NL= docXML.getElementsByTagName("Word");
          Node NodeEntity = NL.item(0);
          Node node = NodeEntity.cloneNode(true);
          XMLElementary.importNode(node,true);          <--------------
here is the problem ...
          return XMLElementary;
     }

and the java executer answers :
Exception in thread "main" java.lang.NullPointerException:
        at Interrogateur.Decomposer(Interrogateur.java:34)
        at Interrogateur.Interroger(Interrogateur.java:47)
        at Mediateur.construire(Mediateur.java:69)
        at Mediateur.main(Mediateur.java:43)

I understand why : it is bescause I initialize XMLElementary with null ...
but I don't know how I can do otherwise : if I don't initialize my new
document XMLElementary, it refuses compiling the code ....

Does anybody have a clue ??

Thanks !


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org