abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: Advice on extending Entry
Date Wed, 27 Jun 2007 17:47:57 GMT
The first question I would have is why :-)

Using ElementWrapper, you can implement code for your application
specific XML as extensions then work directly with it rather than going
through a subclassed entry.  For instance...

Entry entry = factory.newEntry();

Foo foo = factory.newElement(MyConstants.FOO);
foo.setBar("baz");
entry.setContent(foo,"application/foo+xml");

entry.writeTo(System.out);

<entry xmlns="...">
  ...
  <content type="application/foo+xml">
    <foo xmlns="http://example.org/foo">
      <bar>baz</bar>
    </foo>
  </content>
</entry>

All you need to make this work is has Foo extend either the
ElementWrapper or ExtensibleElementWrapper classes, and provide/register
an ExtensionFactory implementation.

- James

Rob Evans wrote:
> I'm playing w/ the idea of extending Entry in order to stuff
> application specific XML into the content tag. Is this kosher? Any
> pointers/examples for doing such things?
> 
> OrderEntry entry = new OrderEntry();
> 

Mime
View raw message