[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: [relax-ng] Compact syntax issue: namespace declarations
>> 2. Solve it by providing a syntax for local namespace declarations, e.g.
>>
>> local {
>> namespace x = "http://www.example.com/1"
>
> I favor this, with slightly different syntax:
>
> local namespace x = "http://www.example.com/1" { ... }
>
> Granted, if you have lots of local namespaces, this makes for
> lots of braces. So we could allow
>
> local namespace x = "foo", y = "bar" { ... }
Using a comma feels inconsistent with other parts of the syntax:
xsd:number { minInclusive = "2" maxInclusive = "3" }
elem [ x ="foo" y = "bar" ]
I think this syntax would be OK if it was sufficient to allow such "local"
expressions only where patterns were allowed. However, consider something
like
<text>
<x:foo xmlns:x="http://www.example.com/1"/>
<x:foo xmlns:x="http://www.example.com/2"/>
</text>
This would turn into:
[ local namespace x ="http://www.example.com/1" { x:foo [] }
local namespace x = http://www.example.com/2" { x:foo [] } ] text
Blech! The curly braces will contain different things depending on the
context of the "local" expression. Also this is going to cause problems
with reserved words: at the moment nothing inside square brackets is
reserved.
An alternative would be to use an XMLish syntax, eg
[ x:foo [ xmlns:x = "http://www.example.com/1" ]
x:foo [ xmlns:x = "http://www.example.com/2" ] ] text
or
xsd:QName { [xmlns:x = "http://www.example.com"] "x:y" }
This only makes sense as a syntax in the context of XML, but I think the
only reason for providing local namespace declarations is compatibility
with XML. It's not a very beautiful syntax, but I think it would be
unsurprising to users.
James
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC