1 Reply Latest reply on Apr 27, 2007 3:13 PM by 807606

    Extracting Node Value from an XML doc.

      i have an XML doc with the structure
      The XML is created dynamically by me using DocumentBuilder
      <?xml version="1.0" encoding="UTF-8"?>
      I need to extract the value from Element Code

      I am getting no value when I use the flwg code:
      Node firstChildNode=null;
      Node secondChildNode=null;
      NodeList nodeList = dom.getChildNodes();
      for (int i=0; i< nodeList.getLength(); i++) {
      firstChildNode = nodeList.item(i);
       System.out.println("Node Name : " + firstChildNode.getNodeName());
      NodeList nodeList2 = firstChildNode.getChildNodes();
      for (int i=0; i< nodeList2.getLength(); i++) {
      secondChildNode = nodeList2.item(i);
      System.out.println("SECOND Node Name : " + secondChildNode.getNodeName());
      String codeExtractedFromXML = secondChildNode.getNodeValue();  // Null returned.
      }catch(Exception e){
      Shoudnt getNodeValue() return the value of the node?