WADL representation/@element in xmlns=""

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

WADL representation/@element in xmlns=""

Klotz, Leigh
I am reporting a confusion I'm suffering about a WADL
representation/@element which refers to an element not in a namespace,
or in xmlns="" if you prefer to treat it that way.  I've found what I
believe is ambiguity in the spec, and an error in the
wadl_description.xsl stylesheet.

1. The Issue

My colleague Mariusz Jurgielewicz has shown me a WADL file containing
<application xmlns="http://research.sun.com/wadl/2006/10">
  ...
  <representation mediatype="application/xml" element="foo" />

He noted that wadl_description.xsl was unable to find the Schema for the
representation.

I changed the WADL as follows:
<w:application xmlns="" xmlns:w="http://research.sun.com/wadl/2006/10">
  ...
  <wadl:representation mediatype="application/xml" element="foo" />
since it appears that wadl_description.xsl interprets the namespace of
unqualified attribute values of representation/@element as being in the
default namespace of the context.

However, it still doesn't work.

2. What the spec says

Not seeing much discussion on this list about namespaces or xmlns, I
consulted the WADL paper to see how to express no-namespace @element
values.

The wadl20090202 WADL paper says that representation/element is defined
as follows:
  For XML-based representations, specifies the qualified name of the
root
  element as described within the grammars section - see section 2.3.

It seems like a good idea to be more precise here.  

Since XML doesn't define namespace rules for processing attribute value
content, so that's up to the application.  CURIEs are one approach, but
since this specification is about XML elements themselves, it's not a
good match.  XML Schema is more specific about it.  
The exact XML Schema approach won't work in WADL, because WADL isn't
about exactly one namespace, but I think it points again in the
direction that more precision about unqualified attribute values is
required, either in prose, or in additional markup for the WADL document
itself.  

A cautionary tale: XForms wasn't specific about the namespace of its
xf:bind/@type attribute, and some implementers chose it to default to
the XML Schema, while others chose it to be the host document.  Finally
the WG decided to fix the problems, by making the XForms namespace by
default, and to preserve interoperability with those who had chosen XSD
as the default by including copies of the XSD types in that namespace.

3. What wadl_description.xsl does
As for wadl_description.xsl, I believe that if it is to be able to
render WADL representations with elements in xmlns="", the stylesheet
needs some adjustments.

I found that in wadl_documentation.xsl,
template/@match="wadl:representation|wadl:fault" calls
template/@name="get-element", which its qname argument to be qualified,
and cannot process unqualified element names.

        <xsl:variable name="localname" select="substring-after($qname,
':')"/>

Certainly this could be changed to
        <xsl:variable name="localname">
          <xsl:choose>
            <xsl:when test="substring-after($qname,
':')=''"><xsl:value-of select="$qname" /></xsl:when>
            <xsl:otherwise><xsl:value-of select="substring-after($qname,
':')" /></xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
 
But I suspect a more comprehensive fix is in order.

Leigh.

Reply | Threaded
Open this post in threaded view
|

Re: WADL representation/@element in xmlns=""

Marc Hadley
On Feb 27, 2009, at 3:47 PM, Klotz, Leigh wrote:

>
> 2. What the spec says
>
> Not seeing much discussion on this list about namespaces or xmlns, I
> consulted the WADL paper to see how to express no-namespace @element
> values.
>
> The wadl20090202 WADL paper says that representation/element is  
> defined
> as follows:
>  For XML-based representations, specifies the qualified name of the
> root
>  element as described within the grammars section - see section 2.3.
>
> It seems like a good idea to be more precise here.
>
Would it be sufficient to say that if the value of representation/
@element does not contain a prefix then the element is in no namespace ?

Marc.

Reply | Threaded
Open this post in threaded view
|

RE: WADL representation/@element in xmlns=""

Klotz, Leigh
>From: [hidden email] [mailto:[hidden email]]
>Sent: Wednesday, March 04, 2009 11:11 AM
>To: Klotz, Leigh
>Cc: [hidden email]; Jurgielewicz, Mariusz
>Subject: Re: WADL representation/@element in xmlns=""
>
> On Feb 27, 2009, at 3:47 PM, Klotz, Leigh wrote:
>
> 2. What the spec says
>
> Not seeing much discussion on this list about namespaces or xmlns, I
> consulted the WADL paper to see how to express no-namespace @element
> values.
>
> The wadl20090202 WADL paper says that representation/element is
> defined as follows:
>  For XML-based representations, specifies the qualified name of the
> root  element as described within the grammars section - see section
> 2.3.
>
> It seems like a good idea to be more precise here.
>
>Would it be sufficient to say that if the value of representation/
@element does not contain a prefix then the element is in no namespace ?
>
>Marc.

That would make sense to me, since it makes definition of un-namespaced
elements trivial.
It's not what's implemented in the stylesheet, so the stylesheet would
need to change.
Similarly, it's possible binding tools (if any) have made decisions
already, so authors of tools should be on the lookout as well.

But your suggestion sound good to me.

Thank you,
Leigh.