All entries for Tuesday 30 August 2005

August 30, 2005

Baby Report: JDOM code for appending Lawrence

Follow-up to Baby Report: The latest photos of Lawrence from Transversality - Robert O'Toole

I've been doing lots of work with the JDOM Java xml parser. The result is as follows:

Element robert = reality.getRootElement();
Element lawrence = new Element("Lawrence");
robert.appendChild(lawrence);

However, if I try the following:

Element robert = reality.getRootElement().getChild("robert");
Element emma = reality.getRootElement().getChild("emma")
Element lawrence = new Element("Lawrence");
robert.appendChild(lawrence);
emma.appendChild(lawrence);

I get a nasty error message stating that the element lawrence cannot be appended to more than one parent element. Does XML only support single parent families? Should i be doing something tricky with XLink? Help!