You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Cory Hubert <cl...@invertica.com> on 2001/02/18 07:16:11 UTC

Issues with DomParser

	Hello.   I am having some issues using the DOMParser.  I read the
Documentation. And I believe I am doing everything correctly.  The following
code reads in the xmlResponse.xml document correctly, you can deve get the
name of the Nodes within the document.  BUT you can't retrieve thier values.
Any Idea what could be the issue?


			DOMParser p = new DOMParser();
			InputSource source = new InputSource("xmlResponse.xml");
			p.parse(source);
			Document doc = p.getDocument();
			Element docElement = doc.getDocumentElement();

			for (int i =0; i < docElement.getChildNodes().getLength(); i++)
			{
				System.out.println(docElement.getChildNodes().item(i).toString());
			}

  Invertica
 :Cory L Hubert
 :Senior Software Engineer
 :[p]646-792-6588
 :[f]212-571-3588

Re: Issues with DomParser

Posted by Elena Litani <hl...@jtcsv.com>.
Hi, Cory,
Please, use xerces-j-user@xml.apache.org mailing list for such
questions.

>System.out.println(docElement.getChildNodes().item(i).toString());
 
Use getNodeValue() to get value of the node.
See samples/DOMWriter.java and read
http://www.w3.org/TR/DOM-Level-2-Core/core.html.

Elena