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
---
Jess Nielsen
Management Consultant / System Developer
Ementor Denmark A/S
E-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]