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: [relax-ng] Limitation in the compact syntax


James Clark scripsit:

> I assume you are referring to the lack of local namespace declarations in 
> the compact syntax. I think that is a very different kind of imperfection 
> to the one you are contemplating. XML -> compact -> XML works just fine 
> except for perverse XML documents that use prefixes inconsistently.  

No, I was actually thinking of things like name attribute vs. name element
and the degenerate groups that you mentioned below.

> For example 
> you can use XSLT to transform a schema in the compact syntax by 
> transforming to the XML syntax, applying XSLT and transforming back to the 
> compact syntax.

Good point.

> I don't think this is acceptable.  That means that you affectively lose the 
> ability to use XML tools to manipulate the compact syntax whenever to use 
> embedded RNG in annotations feature.

Not utterly.  It's just that embedded RNG after roundtripping will not
be presented as clearly as it might be, not that it won't *work*.
Converting back to XML will get you the same semantics as before,
whatever they might be.

> For example, the 
> compact syntax represents both
> 
>   <element name="foo"><empty/></element>
> 
> and
> 
>   <element><name>foo</name><empty/></element>
> 
> by
> 
>   element foo { empty }
> 
> and all of
> 
>   <choice><ref name="foo"/></choice>
>   <group><ref name="foo"/></choice>
>   <interleave><ref name="foo"/></interleave>
> 
> by
> 
>   (foo)
> 

Which is precisely why exact XML > compact > XML roundtripping does not
work even now, though the semantics are in fact preserved by this.

> Translating annotations in the XML 
> syntax into the embedded RNG syntax in the compact syntax would not 
> preserve elements and attributes because the compact syntax is not a 
> representation of elements and attributes but a representation of an 
> abstract structure which can have multiple representations as elements and 
> attributes.

I agree, which is why I do not propose that XML > compact translations
preserve these things.  It is merely a notation of convenience for the
compact-syntax author.  In the direction compact > XML, after all, the
translation is well-defined.

> Let's suppose ooRNG had been done differently, so that we had rng:grammar 
> elements containing os:class elements that in turn contained rng:* 
> elements.  Is that the kind of thing you are thinking of?

Yes.

> In such a case, 
> the ooRNG schema might well conform to the RNG schema.   However, it 
> wouldn't semantically be RELAX NG.  If I fed it to jing -c it, wouldn't 
> work.  It would need to be translated first.

Of course it would; first from the compact syntax to the XML syntax via Trang,
and then from the XML syntax to pure RNG via XSLT.

> I also thing that if you are doing something like ooRNG, then the syntax 
> you get using embedded RNG in annotations would not be at all 
> user-friendly.  It would be much better to design a proper, integrated 
> syntax such as I illustrated for ooRNG.

I actually agree in this particular case, but the cost of writing your
own translator relative to inserting a few annotations would be high.

-- 
John Cowan           http://www.ccil.org/~cowan              cowan@ccil.org
To say that Bilbo's breath was taken away is no description at all.  There
are no words left to express his staggerment, since Men changed the language
that they learned of elves in the days when all the world was wonderful.
        --_The Hobbit_


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


Powered by eList eXpress LLC