You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@abdera.apache.org by Johnny Tolliver <to...@ornl.gov> on 2009/02/27 20:17:19 UTC
Non-standard elements in Atom
Hi! I'm new to Abdera and the mailing list and have just one question.
I need to be able to build an Atom document that has some extra non-
standard elements in it. For example, in addition to <title> and
<subtitle> for a <feed>, I need to add a <summary> element. The name
<summary> was chosen to match the <summary> that's available in an
<entry>, but I need it at the <feed> level in addition to the entries.
Similarly, I need a <subtitle> and a <published> in an <entry>.
Is that usage supported in Abdera? Perhaps in the extension mechanism?
Thanks,
Johnny Tolliver
tolliver@ornl.gov
865-574-1305
Re: Non-standard elements in Atom
Posted by Bryon Jacob <br...@jacobtx.net>.
Johnny -
What you want to do is supported, but you will need to put the
elements into a different namespace (since there is no <summary>
element on a <feed> element in the http://www.w3.org/2005/Atom
namespace)
Your XML will look something like:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:tolliver="http://johnny.tollivers.namespace.url
">
<title type="text">title goes here...</title>
<tolliver:summary>Here's your Summary Element</tolliver:summary>
<entry>
... you get the drift from here ...
</entry>
</feed>
The Abdera API supports this nicely - you would do something like the
above as follows:
Feed feed = getMyFeedObjectSomehow();
QName summaryQName = new QName("http://johnny.tollivers.namespace.url
", "summary", "tolliver");
feed.addSimpleExtension(summaryQName, "Here's your Summary
Element");
if you needed a richer structure to an extension, Abdera supports
that, too - but it's a bit more coding.
- Bryon
On Feb 27, 2009, at 1:17 PM, Johnny Tolliver wrote:
> Hi! I'm new to Abdera and the mailing list and have just one question.
>
> I need to be able to build an Atom document that has some extra non-
> standard elements in it. For example, in addition to <title> and
> <subtitle> for a <feed>, I need to add a <summary> element. The name
> <summary> was chosen to match the <summary> that's available in an
> <entry>, but I need it at the <feed> level in addition to the
> entries. Similarly, I need a <subtitle> and a <published> in an
> <entry>.
>
> Is that usage supported in Abdera? Perhaps in the extension mechanism?
>
> Thanks,
> Johnny Tolliver
> tolliver@ornl.gov
> 865-574-1305
>
Re: Non-standard elements in Atom
Posted by Charles Greer <ch...@oreilly.com>.
We've used the extension element feature extensively at O'Reilly.
You'll find that it's trivial to add arbitrary extensions. Naturally
you'll have to wrangle with namespaces... Wearing my RDF hat I'd
suggest you use the Dublin Core
http://purl.org/dc/terms/issued for publication date and
our own
http://purl.oreilly.com/ns/meta/subtitle for subtitle
like this;
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:om="http://purl.oreilly.com/ns/meta/">
<title>My Big Fat Title</title>
...
<om:subtitle>A story about titles</om:subtitle>
<dc:issued>2004-06-22</dc:issued>
</entry>
Charles
Johnny Tolliver wrote:
> Hi! I'm new to Abdera and the mailing list and have just one question.
>
> I need to be able to build an Atom document that has some extra
> non-standard elements in it. For example, in addition to <title> and
> <subtitle> for a <feed>, I need to add a <summary> element. The name
> <summary> was chosen to match the <summary> that's available in an
> <entry>, but I need it at the <feed> level in addition to the entries.
> Similarly, I need a <subtitle> and a <published> in an <entry>.
>
> Is that usage supported in Abdera? Perhaps in the extension mechanism?
>
> Thanks,
> Johnny Tolliver
> tolliver@ornl.gov
> 865-574-1305
>