Hi,
I think the problem is the following:
If you have an element <Service>aService</Service> then in the DOM-tree the
content "aService" is not located in the node value of the element node
<Service>,
but there exists a child node of type TextNode. So you can access the
content using
indst.getChildNodes().item(0).getChildNodes().item(0).getNodeValue
().toString()
instead of
indst.getChildNodes().item(0).getNodeValue().toString()
it should work this way.
Regards, Bj�rn.
>Hi there,
>
>I'm having a problem with the .getNodeValue() too.
>
> indstillingerFraFil = new DOMParser();
> File xmlFile = new File("TilEPJI.xml");
> FileReader fr = new FileReader(xmlFile);
> InputSource is = new InputSource(fr);
> indstillingerFraFil.parse(is);
> doc = indstillingerFraFil.getDocument();
> Node indst = doc.getFirstChild();
>
>
>System.out.println(indst.getChildNodes().item(0).getNodeName().toString
());
>//Output = "Service"
> String service =
>indst.getChildNodes().item(0).getNodeValue().toString(); //Output =
>NullPointerException
> System.out.println("The value of the element node service " +
>service); // Never reached
>
>The Node is an ElementNode.
>
> XML file:
> <?xml version="1.0" encoding="UTF-8"?>
> <Indstillinger>
> <Service>aService</Service>
> </Indstillinger>
>
>I hope some one will be able to help me soon.
>
>Best regards,
>Jess
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]