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!
Chris May
Sadly yes. Single-parent family trees, anyway. I blame those degenerates at the W3C. ;-)
Fortunately, upstanding members of the community can get round it by introducing a relationship element, linking person elements by ID, a la FOAF. RDF is the cannonical example of adapting XML to handle many-to-many relationships effectively.
In answer to your last question, no you shouldn't be doing something tricky with XLink, you should be changing nappies, or possibly making a nice hot drink for Emma.
30 Aug 2005, 22:20
Joseph
You need to create a root 'family' node, then you can have as many parents and children as you want, but beware of compatibilty conflicts… ¦:¬)*)
31 Aug 2005, 09:57
Robert O'Toole
Chris, that's very phenomenological: two documents, each containing there own seperate 'reality' elements, but somehow joined through the void by a meta-linking act of epoche.
10 Sep 2005, 10:31
Chris May
I thought epoche was a state (specifically, a state of being-in-the-world, of existing without causing, waiting for some external force to determine one's path). What's an 'act of epoche?'
You mean phenomenology in the sense of Husserl / Heidegger I take it, and not in the physics sense of 'making a bit of a guess, which seems right but isn't directly modelled by theory, because the theory isn't sophisticated enough yet ' :-).
I actually think that in this case the latter is a better description: The model (XML) just isn't well suited to to expressing an nn relationship without vague hand-wavy ID relationships that 'join through the void' :-)
12 Sep 2005, 20:16
I'm just not clever enough to understand any of this :)
07 Oct 2005, 16:16
Add a comment
You are not allowed to comment on this entry as it has restricted commenting permissions.