Dear experts,
I am newbie to Xerces, therefore my question might be stupid, but I'd appreciate your commenst very much :
I want to create a parent and childe xml nodes with values :
<element-1>
<element-2> value </element-2>
</element-1>
That is my java program :
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.parsers.*;
public class Aaa
{
public static void main(String[] args)
{
DocumentBuilder db = org.apache.soap.util.xml.XMLParserUtils.getXMLDocBuilder();
Document doc = db.newDocument();
Element e = doc.createElement("element-1");
Element e = doc.createElement("element-1");
e.appendChild(doc.createElement("element-2"));
e.getLastChild().setNodeValue("value");
System.out.println(e.getLastChild().getNodeValue());
}
}
So when I use method e.getLastChild().getNodeValue() it returns null as I understand method setNodeValue("value") did not set the value to the last node <elemet-2>
Could you please help me understand what I do wrong.
Thanks a lot in advance.
Jonas
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
