A
Ale
Hi all,
I need to write a new XML file from scratch, I've just a doubt about
adding an attribute to an element.
This is the code, but maybe there is a way to write less code to do
that.
What do you think about that ?
//START CODE
....
Document doc=docBuilder.newDocument();
Node rootNode=doc.createElement("MarketNews");
Attr id=doc.createAttribute("id");
id.setValue("123456");
NamedNodeMap rootAttr=rootNode.getAttributes();
rootAttr.setNamedItem(id);
doc.appendChild(rootNode);
....
//END CODE
Thanks all and best regards,
Ale
I need to write a new XML file from scratch, I've just a doubt about
adding an attribute to an element.
This is the code, but maybe there is a way to write less code to do
that.
What do you think about that ?
//START CODE
....
Document doc=docBuilder.newDocument();
Node rootNode=doc.createElement("MarketNews");
Attr id=doc.createAttribute("id");
id.setValue("123456");
NamedNodeMap rootAttr=rootNode.getAttributes();
rootAttr.setNamedItem(id);
doc.appendChild(rootNode);
....
//END CODE
Thanks all and best regards,
Ale