OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: Re: Issue: overriding attributes



> This is an important, but I believe we can handle this by:
> 
> - treating xsi:type as a normal attribute
> - using <value type="QName">
> - using combine="choice"
> - using Murata-san's double indirection technique

It can certainly translatable, but I guess it becomes impractical quickly
in terms of the performance, because sometimes combined choices are
too big. For example, if an element "foo" is declared as the
ur-type (which means it can have any type).

The instance can be

<foo> anything is allowed <including/> child elements </foo>

<foo xsi:type="xsd:string"> this must be string </foo>

Any defined type can appear.


So the equivalent RELAX NG grammar must contain all defined types
(either simple or complex, built-in or user-defined) in one big choice.

<element name="foo">
  <choice>
    <group>
      <attribute name="xsi:type">
        <value type="QName">xsd:string</value>
      </attribute>
      <ref name="string.definition"/>
      ...
    </group>
    ...
  </choice>
</element>

The <choice> can easily have hundreds of options.




> > - lax validation
> 
> This is awkward, but I think it can be done.

That is also certainly true, but now the converter needs to know the
whole grammar. If it can read the whole grammar, then the attribute
restriction could also be easily handled without using a dedicated
mechanism, I guess.

It also makes module-to-module conversion impossible, if it was still
possible.

And the converted grammar is considerably ugly.



> > ... and more.
> 
> Such as?

- the capability to load schemata dynamicaly by using the
  xsi:schemaLodation attribute.



Another problem is how references are resolved.


Consider three XSD files A,B and C.

A.xsd:  namespace URI="A"
<complexType name="T">
  ...
</complexType>

B.xsd: namespace URI="B"
<complexType name="T"
  <extension base="A:T">
    ...
  </extension>
</complexType>

C.xsd: namespace URI="C"
<element name="foo">
  <complexType>
    <sequence>
      <element name="child1" type="A:T"/>
      <element name="child2" type="B:T"/>
    </sequence>
  </complexType>
</element>


In W3C XML Schema, a schema can access(refer) to any declarations in
any included/imported schemata.

In RELAX NG, on the other hand, references between <grammar>s are
highly restricted. It can only access declarations in itself, in the
parent grammar, or in the child grammar.

So we cannot map a schema of W3C XML Schema to a grammar of RELAX NG.
To convert the above example, we have to put everything into one
<grammar>. Thus name collision handling becomes necessary.


All those things make the converted RELAX NG grammar illegible.



> > 1. I don't think its widely used
> 
> Have you looked at many schemas to verify this or are you just guessing? 
> One widely used schema that uses this is the schema for schemas.

No, I was just guessing.


regards,
--
Kohsuke KAWAGUCHI                          +1 650 786 0721
Sun Microsystems                   kohsuke.kawaguchi@sun.com



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC