[jdom-interest] Modifying JDOM tree

de Grijs, Rudolf Rudolf.de_Grijs at softwareag.com
Wed Mar 28 07:15:46 PST 2001


Is there a (simple) way to create the missing pieces automatically if I try
to add an element to an optional parent(s), e.g.


<!ELEMENT email(from, to, cc?, subject, body)>
<!ELEMENT from (#PCDATA)>
...
<!ELEMENT cc (mailadress)>
<!ELEMENT mailaddress (name, host, ..)>


Assume i want to add the name  of mailaddress as follows

	email.getChild("cc").getChild("name").addContent("my.name")

Since cc is optional this expression might fail. In that case I would like
JDOM to create element cc and name as a side effect. I do understand this
might get difficult, certainly if the cardinality of cc changes to cc*.

What do you think about this idea?


Regards,
Rudolf de Grijs



More information about the jdom-interest mailing list