The content of Atom feeds can be text, XHTML or XML (entries can also link to arbitrary media types too). When using XML for the atom:content, it might be nice to be able to discover the schema up front - which could help tooling / UIs / frameworks.
e.g. from the AtomPub service document when looking at each collection provide an easy way to get the schema document. I've been googling to see if anyone has done such a thing; I've not yet found an obvious answer.
One idea is to use content types; something like
<collection>another could be to add a new kind of link to the feed
<accept>application+xml; type=someSchemaURI</accept>
</collection>
<feed>I guess a tool could always just look at the content of the feed and look at the namespaces then do some out of band google search for schemas for those namespaces :) but it might be nice to be able to make it a little easier to auto-detect the schema - particularly as AtomPub has gone to great lengths to make everything else (system, workspace, collections, entries) easily discoverable and navigable.
<link rel="content-schema" type="application/relax-ng-compact-syntax" href="/schemas/something.rnc">
...
</feed>
Anyone else figure out a neat way to expose the schema of the XML inside the content for collections or feeds?
5 comments:
I think another option would be some type of features/policy approach:
http://netzooid.com/blog/2007/09/25/atompub-ws-policy/
All I want is a way to link mimetypes and schemas. APP is so close, but so far...
Yeah! If we there were a standard mime type -> schema mapping we'd be sorted. This would also work great in HTTP too!
Its a bit of a hack but I wondered about just hacking MIME to be
application/xml; schema=someURI
or in the case of SOAP/Atom wrapped stuff something like
application/atom+xml; schema=someURI
The problem with mime types (at least if you're transmitting them as an HTTP header) is that you can't figure out any of this stuff ahead of time. Granted this could work in the APP services document like you describe. It'd be great though if there was just a generic way to query what resources were available, what mime types the resources could be represented as, and how those mime types related to some description/schema (if they do relate at all).
A while back, Sanjiva and some other folks from WSO2 got in touch to propose something very useful regarding MIME types and their connection to XML schemas. I have no idea why they didn't make it public ... it might make sense to follow up with them.
Post a Comment