[jdom-interest] what happens when a duplicate element is added

William Krick wkrick at eio-online.com
Tue Dec 30 11:09:06 PST 2003


Using JDom b9, and given the following xml...


<?xml version="1.0" encoding="UTF-8"?>
<root>
  <tag1>ABC</tag1>
  <tag2>123</tag2>
</root>


...assume I have the above XML in a valid Document object "doc"
and I do this in my code...


Element root = doc.getRootElement();
root.addContent(new Element("tag2").addContent("456"));


What happens?
  
Do I end up with duplicate "tag2" tags?
  
Does "tag2" get replaced?

Is an exception thrown?


...
Krick




More information about the jdom-interest mailing list