At last sorted it :)

because I was returning an element I needed to again call
NodeList nList = element.getChildren();
this gave me a text node and i could then get the value.

what a pain is there no direct way to simply do this.

Code::

DocumentBuilderFactory dbf =    DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(inStream);
// get the root element
Element eRoot = doc.getDocumentElement();
NodeList nList = eRoot.getChildNodes();
NodeList cTitle = nList.item(0).getChildNodes();
Node eTitle = cTitle.item(0); //TextNode


Nic
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Nic
Jackson
Sent: 19 May 2002 20:36
To: [EMAIL PROTECTED]
Subject: Re: Problems getting a node value


Further to my previous post I can confirm that the <title> is being returned
as a node type element which is why im getting null value.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to