text nodes and element nodes

Hi

I'm not sure what is going on here. We have the following code segment

String xmlSid = SessionManager.createNewSession("edmunds", "0");
    StringBufferInputStream sbisd = new StringBufferInputStream(xmlSid);

    InputSource isid = new InputSource(sbisd);
    Element sessionInfo =
this.xspParser.parse(isid).getDocumentElement();

This returns us the correct Element, however when we work through the
Element to get the required node, it has ELEMENT_NODE type, this means
we can't retrive the value

the Element looks like

<SESSION>
  <SESSIONID>1234567865645</SESSIONID>
  <COMMUNITYID>12837743837379182</COMMUNITYID>
</SESSION>

the code we use to try and get the value is

NodeList sessionTag = sessionInfo.getElementsByTagName("*");
Node st = sessionTag.item(0);
String sid = st.getNodeValue();

However as I said the Node st is of type ELEMENT_NODE, I seem to have no
control over this, what can I do to ensure its a text node, which it
looks like to me?

Cheers
Andrew

Received on Monday, 10 April 2000 18:33:48 UTC