← Prev in month ← Prev in thread

[relax-ng] Compact syntax issue: namespace declarations

From
James Clark <>
Date
2002-04-03T06:06:33+00:00
ID
007301c1dad5$2daa0190$
Thread
[relax-ng] Compact syntax issue: namespace declarations
At the moment, the compact syntax allows only file-level namespace
declarations.  This creates a problem in translating from the XML syntax to
the non-XML syntax.  If a schema in the XML syntax uses prefixes
inconsistently (which is not disallowed either by XML or RELAX NG), then it
becomes difficult/impossible to translate it automatically to the non-XML
syntax.  The translator cannot simply rename the prefixes, because the
in-scope namespaces might be significant for an annotation or for a <value>.
For example,

<group>
  <element name="foo" p:assert="count(.//x:foo) = 17"
    xmlns:x="http://www.example.com/1">
    <ref name="foo"/>
  </element>
  <element name="bar" p:assert="count(.//x:foo) = 17"
    xmlns:x="http://www.example.com/2">
    <ref name="bar"/>
  </element>
</group>

There are two basic solutions:

1. Live with it.  Schemas in the XML syntax that use prefixes inconsistently
may not be translatable into the non-XML syntax.

2. Solve it by providing a syntax for local namespace declarations, e.g.

local {
  namespace x = "http://www.example.com/1"
  [ p:assert="count(.//x:foo) = 17" ]
  element foo { foo }
},
local {
  namespace x = "http://www.example.com/2"
  [ p:assert="count(.//x:foo) = 17" ]
  element bar { bar }
}

James
← Prev in month ← Prev in thread