Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Received: (qmail 60076 invoked from network); 12 May 2000 11:49:21 -0000 Received: from raven.ecs.soton.ac.uk (152.78.70.1) by locus.apache.org with SMTP; 12 May 2000 11:49:21 -0000 Received: from penelope.ecs.soton.ac.uk (penelope.ecs.soton.ac.uk [152.78.68.135]) by raven.ecs.soton.ac.uk (8.9.3/8.9.3) with ESMTP id MAA14353 for ; Fri, 12 May 2000 12:49:14 +0100 (BST) Received: from penelope (penelope [152.78.68.135]) by penelope.ecs.soton.ac.uk (8.9.1a/8.9.1) with ESMTP id MAA04895 for ; Fri, 12 May 2000 12:49:13 +0100 (BST) Date: Fri, 12 May 2000 12:49:12 +0100 (BST) From: Cheun N Chong To: general@xml.apache.org Subject: HELP: How to get the value of the node Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Hi all, Perhaps I have really repeated my question several times and I am terribly sorry about that. I am quite frustrated here. I have the following codes: =============== THE XML CODES ======================= milk 6 may 2000 pork chop 7 may 2001 =============== THE JAVA CODES ====================== fileinput = new FileInputStream("stuff.xml"); xmlinput = new InputSource(fileinput); // Use a DOMParser from Xerces so we get a complete DOM from the document DOMParser parser = new DOMParser(); parser.parse(xmlinput); // Get the document and the node list of the required tag name Document doc = parser.getDocument(); NodeList nl = doc.getElementsByTagName("Expire"); out.println(nl.getLength()); Node n = nl.item(0); String value = nl.item(0).getNodeValue(); out.println(value); ====================================================== I want to get the node value of Expire for milk. However when I tried that code, it print out "null" but when I change the getNodeValue() to getNodeName(), it can print out the "Expire". Is there any wrong codes. I really need your expertise. Thousand thanks. Wish you all the best. Best regards, Cheun Ngen CHONG