[
Lists Home |
Date Index |
Thread Index
]
Isn't this a problem with coupling of your data model to the implementation of one
processor of the data, rather than a problem of the data model? If you go the other
way, OO implementation to XML data model, you end up with XMI- it does the job of
representation, but is sub-optimal as human readable mark-up. There's no reason
that going the other way would be any better- an automatic, default mapping of the
attributes in a human readable markup element won't necessarily provide an
efficient level of abstraction for a particular programming language.
You could also solve that particular problem by using a code generator that allows
mapping a simpleType to an instance of a object, eg:
class Link {
final String locator;
final String role;
Link (String locator) ...
}
interface LinkContainer {
Map getLinks () ;
void setLinks (Map links) ;
}
class ImgElement implements LinkContainer {
Link img;
void setImg (String locator) { img = new Link(locator, "include"); }
Link href;
void setHref (String locator) { img = new Link(locator, "traverse"); }
public Map getLinks () {
// construct map of name-link
...
}
Gives you generic linked container functionality, with the option of multiple
locators. The locator dereferencing or whatever tasks associated with links is
contained in the Link class, and anything can be a link container. The role should
be probably be a enum that double dispatches to allow that to be cleanly used,
again not something a simple code generator will do for you.
Not that this effects whether XLink is good or not, but rather it's goodness as
markup should considered as a function of the quality of the code generator you are
using.
Pete
----
Henrik Martensson:
I am a bit wary of using multiple locators on the same element because
Java classes will be generated from the schema, and I am not convinced
that making one object responsible for several links is a hot idea. I
prefer to keep the classes small, simple, and focused on a single task.
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
|