Subject: Re: [Simple] Presence Relax NG schemas

From: Jari Urpalainen <[email-masked]>
Date: Mon, 01 Aug 2005 10:58:39 +0300

On Sun, 2005-07-31 at 10:22 -0400, ext Jonathan Rosenberg wrote:
> I don't have any particular views on the pros/cons of XML schema vs. 
> relax NG. However, my concern about this is whether there is value in 
> having TWO definitions of the grammar for these documents. It seems that 
> this is a recipe for interoperability problems. An XML-schema-using 
> implementation might define a document that is valid according to the 
> schema, but invalid according to the RELAX-NG definition. That would be 
> a problem. If that never happens, and neither can the converse (a 
> RELAX-NG compliant document that is not schema compliant), then the 
> RELAX-NG description is isomorphic to the XML schema, and so what is the 
> value exactly?
> 
> -Jonathan R.
I'll agree that it is not definitely an optimal solution to have two
definitions. Anyway, as you know, with the current W3C schemas you
cannot express where to put e.g. some extension elements when there are
many possible extension points: you could add e.g. <dm:person> element
under <presence>, <tuple> and <status>. And once you add new schemas
extension points just increase. However, these Relax NG schemas do not
allow this ambiguity. So they follow more strictly the intention of the
specs. Of course if these schemas don't correctly follow the specs, I am
glad to receive fixes.

Secondly, I am aware that ietf/xml-dev had these schema tool discussions
awhile back ago. AFAIK the recommendation does not mandate to use only
W3C schemas, it just seems to be the prevailing habit. At least in this
particular case Relax NG fits better for the task, imo.
As Aki notes, SIMPLEt might be the best "home" for this, but the schemas
have to be available somewhere (and bug free) 

thanks,
Jari

_______________________________________________
Simple mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/simple

---

From: Jonathan Rosenberg <[email-masked]>
Date: Mon, 01 Aug 2005 04:43:02 -0400

inline.

> particular case Relax NG fits better for the task, imo.

Sure, working groups should always be able to discuss XML schema vs. 
RELAX vs. DTD. However, that discussion is appropriate in the beginning 
of the cycle. The group has already chosen XML schema, and I don't 
believe you are proposing to change that decision. As such, I think its 
far more important to have a single definition of the grammar.

> have to be available somewhere (and bug free) 

XML schema definitions, sure, the IANA registry will provide that for 
us. I am concerned about having any home for a second, independent 
definition of the grammar.

-Jonathan R.
-- 
Jonathan D. Rosenberg, Ph.D.                   600 Lanidex Plaza
Director, Service Provider VoIP Architecture   Parsippany, NJ 07054-2711
Cisco Systems
[email-masked]                              FAX:   (973) 952-5050
http://www.jdrosen.net                         PHONE: (973) 952-5000
http://www.cisco.com

---

From: Andrew Newton <[email-masked]>
Date: Mon, 1 Aug 2005 16:12:03 -0400

On Aug 1, 2005, at 3:33 PM, Ned Freed wrote:

> I guess having more than one defintion is OK as long as only one of  
> them is
> considered to be normative.

I agree with this.  If somebody is using an informative schema for  
validation purposes, it is probably better they use one that has been  
reviewed rather than one they derive privately.

> There's some similarity between this issue and the issue of  
> recasting existing
> data formats in XML. It may make sense to define, say, an XML  
> variant of the
> iCalendar format, but unless a wholesale migration to the XML  
> format is planned the original format needs to be the normative  
> one. Imposing additional
> constraints, or worse, adding extensions in a secondary format is a  
> really
> bad idea IMO.

Though I don't view it this way.  I view it as there are multiple  
ways to describe valid XML for a particular application but they all  
describe the same XML.

-andy

---

From: Jonathan Rosenberg <[email-masked]>
Date: Mon, 01 Aug 2005 17:45:21 -0400

inline.

Ned Freed wrote:

> I'm afraid I have to agree with Jonathan here. I don't especially care what
> definition tool is used (although I like it when one is used...), but using
> more than one could lead to all sorts of unnecessary excitement. I 
> personally
> haven't used Relax NG for much, but I use both DTDs and Schemata all the 
> time
> and the overlaps between the two can be... well, interesting.
> 
> I guess having more than one defintion is OK as long as only one of them is

What is it mean for a grammar definition to be informative though? If 
its used in any way at all, its for validation of message content, and 
that fundamentally leads to the interoperability problems I'm talking 
about above.

> 
> There's some similarity between this issue and the issue of recasting 
> existing
> data formats in XML. It may make sense to define, say, an XML variant of 
> the
> iCalendar format, but unless a wholesale migration to the XML format is 
> planned the original format needs to be the normative one.

I think thats different though. The XML version of iCal is a different 
document than the existing one. When you receive a calendar document, 
there is no confusion about which grammar it complies to. Its either 
XML, or its not. Here, we're talking about the same document, but with 
two different syntaxes that define the rules for its construction. There 
is no way from looking at the document to know which it was actually 
created from and validated against.

-Jonathan R.

---

From: Henning Schulzrinne <[email-masked]>
Date: Tue, 02 Aug 2005 02:56:38 -0400

Would the following requirements solve the problem:

(1) All documents MUST comply with the relevant schema definitions (and 
the non-schema constraints in the normative documents);

(2) Senders MAY also verify that their document passes the Relax NG 
test. It captures some of the non-schema constraints.

(3) Receivers SHOULD accept any schema-compliant document.

If these steps are followed, senders may be more strict in sending than 
the schema indicates, but there is no danger of emitting a non-compliant 
document. Step (3) is a version of what we discussed, namely the "be 
liberal in what you accept". (Obviously, many of the likely violations, 
such as use of elements in the wrong encapsulating element, will not be 
processed at all, but just be ignored since the receiver won't look for 
them.)

Henning

---

From: Jonathan Rosenberg <[email-masked]>
Date: Wed, 03 Aug 2005 05:18:34 -0400

This captures the spirit of we want, I think. My concern is simply that, 
in practice, having two definitions that specify the grammar for the 
same document might cause interop problems:

   a. there are subtle differences in the schemas, not noticed during 
the design, that result in a mismatch in compliance - that is, a 
document is compliant to the XML schema but NOT the relax-ng definition. 
It seems hard to PROVE that this cannot happen...

   b. folks who really like one type of schema definition over the other 
(i.e., really like relax-ng over schema), decide to ignore the advice 
below, and use the informational schema for validating documents received

To be really clear, I have no problem with relax-ng. I trust experts in 
this space who say its better. My concern is having TWO specs that 
define the grammar for a single document, whatever those schemas are.

-Jonathan R.

---

From: Henning Schulzrinne <[email-masked]>
Date: Wed, 03 Aug 2005 05:29:11 -0400

>   a. there are subtle differences in the schemas, not noticed during the 
> design, that result in a mismatch in compliance - that is, a document is 
> compliant to the XML schema but NOT the relax-ng definition. It seems 
> hard to PROVE that this cannot happen...

Agreed - but I believe that the "algorithm" I proposed will make this 
problem harmless. Implementors using only the schema are no worse off, 
but those doing the additional checking won't generate such documents.

> below, and use the informational schema for validating documents received

These same folks probably code from the examples in the draft and think 
that schema verification is for wimps. I don't think we can help 
maliciously lazy implementors but shouldn't penalize the conscientious ones.

> define the grammar for a single document, whatever those schemas are.

There are trade-offs, but given the limitations of what we have to deal 
with, I'm hopeful that this will, in this case, the average outcome will 
be better than not having this. In addition, I suspect that, in 
practice, any discrepancies will be discovered very quickly, 
particularly those where the Relax-NG scheme is more liberal (which is 
the only harmful case).

Henning

---

From: Ned Freed <[email-masked]>
Date: Mon, 01 Aug 2005 12:33:13 -0700 (PDT)

I'm afraid I have to agree with Jonathan here. I don't especially care what
definition tool is used (although I like it when one is used...), but using
more than one could lead to all sorts of unnecessary excitement. I personally
haven't used Relax NG for much, but I use both DTDs and Schemata all the time
and the overlaps between the two can be... well, interesting.

There's some similarity between this issue and the issue of recasting existing
data formats in XML. It may make sense to define, say, an XML variant of the
iCalendar format, but unless a wholesale migration to the XML format is planned 
the original format needs to be the normative one. Imposing additional
constraints, or worse, adding extensions in a secondary format is a really
bad idea IMO.

				Ned

---

From: Ned Freed <[email-masked]>
Date: Mon, 01 Aug 2005 19:03:26 -0700 (PDT)

> What is it mean for a grammar definition to be informative though?

It means the definition is provided for convenience only, it cannot
be used to determine compliance (or lack thereof).

> If

We see this sort of thing all the time with language compilers. It is
common for such tools to perform checks that are simultaneously less and more
stringent than the language standard requires. As long as the compiler doesn't
call any more stringent checks it performs an error there isn't a problem.

> created from and validated against.

This is really a matter of intent, isn't it? If the intent in using an
additional specification language is simply to have an alternative in there,
then I see little purpose in it and some potential for harm. (This goes for the
XML variant of iCalendar, BTW.) If, OTOH, the intent is to provide, say, a test
for potentially expensive usage, or some other check for legal but potentially
problematic constructs, I think there could be some utillity in having a second
informative definition. In fact it might even make sense to have two
definitions in the same specification language.

However, I don't believe XML Schema lends itself to this sort of usage. (The
error messages I usually get from schema validators aren't exactly a model of
clarity...) I haven't used Relax NG enough to know if it does or not.

				Ned

---

From: Tim Bray <[email-masked]>
Date: Tue, 02 Aug 2005 11:59:52 -0700

> and the overlaps between the two can be... well, interesting.

The Atompub group, which I co-chair, is in the late stages of the  
IESG approval process for a document that includes a non-normative  
schema, provided in RelaxNG (the RNC compact format, to be precise).   
The XML expertise in this WG is substantial, and RelaxNG was chosen  
on that basis.  I think the following are material to this discussion:

- Many people in the XML community - I hesitate to say consensus, but  
would claim at least a plurality - feel that RNG is substantially  
technically superior to both DTDs and W3C XML Schemas.  DTDs are  
reasonably sound as far as they go, but that's not very far, and they  
are very deeply rooted in document-publishing applications.  W3C XML  
Schema is a profoundly bad design which exhibits very poor  
comprehensibility and interoperability.  It has become a boring non- 
event on the various XML-geek mailing lists for someone to want to do  
something fairly obvious in a language and be told "You can't do that  
in XML Schema, but here's a 5-line RelaxNG idiom that does it cleanly  
and exactly."
- There is an excellent open-source tool, trang, that converts  
reasonably well between DTDs, Relax, and XML Schema.  People who use  
this typically use the Relax as the primary format since it's  
simultaneously richer and simpler.  There is a problem in that many  
useful specifications fail to meet XML Schema's idiotic UPA  
requirements, and many designers refuse to cripple their designs to  
do so, so in fact many highly implementable languages simply cannot  
be expressed in XML Schema.

  -Tim

---

From: Tim Bray <[email-masked]>
Date: Wed, 03 Aug 2005 04:48:24 -0700

> (3) Receivers SHOULD accept any schema-compliant document.

If you're talking about Presence, maybe.  In the general case, NO.   
It is common for languages to have validity requirements that cannot  
be expressed in a schema.  A trivial example: an IP address might  
appear as an element in a document, and the governing specification  
might state that the server at that address SHOULD be responsive to  
messages of type X on port Y.  Go schema that.  -Tim

---

From: Dean Willis <[email-masked]>
Date: Tue, 16 Aug 2005 13:30:37 -0500

> document is compliant to the XML schema but NOT the relax-ng 
> definition. It seems hard to PROVE that this cannot happen...
>
Actually, we can prove that it CAN happen. The whole point of the 
Relax-NG definition is that it is narrower than what cane be specified 
with an XML schema. Thus, there are documents that would validate 
according to the XML schema, but not validate according to the Relax-NG 
definition.

The point I believe Jari is making is that the documents that would not 
be valid according to Relax-NG would also not be consistent with the 
draft's usage guidelines, and thus would also appear invalid to the 
visual observer. Consequently, it would be useful to have a stronger 
validation tool than the XML schema available for implementors.

--
Dean

---

From: Jari Urpalainen <[email-masked]>
Date: Wed, 17 Aug 2005 14:00:50 +0300

> validation tool than the XML schema available for implementors.
Dean, this was exactly my intention. In conclusion, if I have understood
correctly, there's a rough consensus that this work can continue (as
informative target, of course) ? 

In general, I'll agree with Jonathan's concerns. In theory, there are
some features in W3C Schemas that cannot be represented with RNG, but
they are not used in presence schemas. So, I'll still see that these are
more useful for implementers (and yes reviewers are welcome). Although
I'll agree totally with Tim (and e.g. James Clark's comments etc) about
RNG versus W3C Schemas I wouldn't have bothered to start this work if
W3C schemas would have had a reasonable versioning support (although
there are many other annoyances as well). Furthermore, one of my
favorite libraries (libxml2) supports RNG and the validation performance
is pretty good with it (much faster than a comparable tool for W3C
schemas). Btw. there's an excellent book about RNG
http://books.xmlschemata.org/relaxng/

Another issue is whether WGs should really rethink which validation tool
to use. Personally I hardly would miss W3C Schemas (structures not
datatypes, which are imo ok and which can be used with RNG, too)

br,
Jari