[rest-practices] Namespace qualifying respresentation types

Bryan Kearney bkearney at redhat.com
Fri Apr 30 14:34:37 UTC 2010


On 04/30/2010 10:19 AM, Daniel Veillard wrote:
> On Thu, Apr 29, 2010 at 11:55:07AM +0100, Eoghan Glynn wrote:
>> Folks,
>>
>> I wanted to get the group's feeling for the use of namespaces in
>> representation types.
>>
>> The context for the question initially comes from a discussion about how
>> action/operations were to be modelled in RHEVM-API, particularly how to
>> capture the action-specific parameter types in the schema. In XML schema
>> terms, my first cut was to use an xs:any within the action element, but to
>> restrict the contained type to the local namespace. Which of course requires
>> that a target namespace is defined in the first place.
>
>    Why XML Schemas ? Why not Relax-NG instead.
> As an implementor, I *strongly* suggest to avoid XSD unless for very
> very simple things. And even very simple thing are described in very
> painful terms with no formal semantic. No later than today I had to dig
> in
> http://www.w3.org/TR/xmlschema-1/#Simple_Type_Definition_details
> for some other Red Hat employees requesting help. This thing is horrid
> please avoid it.
> In contrast Relax-NG specification is 1/ clear 2/ includes a formal
> semantic description 3/ has more expressive power than XSD and is
> even an ISO standard.
> http://www.oasis-open.org/committees/relax-ng/spec-20011203.html
>
>    Actually I would be very surprised if there wasn't a way to use
> xs:any allowing only non-namespaced elements, but considering the
> lack of clarity of the spec, no matter everybody gets confused. In
> the end people just try with the set of implementation tehy target
> and don't try to understand the real expected semantic of their schemas,
> which IMHO completely undermine the usefulness of XSD in the first
> place.
>
>> So I'm sensing there may be some opposition to this, given that namespacing
>> isn't widely used in the existing RESTful APIs. I guess I'm wondering
>> whether this ommission was a concious decision, or just that nobody saw the
>> need for using namespaces but wouldn't be averse to their use in principle.
>
>    I think that XSD is a bigger mistake than namespaces, though
> namespaces have their set of annoyances. If you go REST I would
> suggest to avoid both, but use Relax-NG as your schemas language.
>
>> Obviously there are other RESTful examples out there in the wild where the
>> xmlns attribute makes an appearance, Atom springs to mind here ...<feed
>> xmlns="http://www.w3.org/2005/Atom">. And I don't need to rehearse the basic
>> advantages of using namespaces, partitioning the global namespace, aiding in
>> validation, encoding version information etc. But I would be interested in
>> hearing if there's determined opposition to their use, and if so what the
>> reasoning is.
>
>    In general they make implementations more complex,for example in
> XPath you will have to register all namespaces before being able to
> execute a query, it's less readable, etc ...
>    My suggestion would be to use a non-namespaced space and use the
> namespaces only for custom extensions if the need arise.
>
> Daniel
>
I do agreee... RelaxNG is much easier to read/write.

-- bk




More information about the rest-practices mailing list