ietf-mta-filters
[Top] [All Lists]

[sieve] Late breaing issue in draft-freed-sieve-in-xml-06.txt

2009-08-21 11:45:52
draft-freed-sieve-in-xml-06.txt has just been through the initial IESG
evaluation process. Various issues were raised, mostly editorial, and I believe
all but one has been addressed in the -06 revision.

The one issue remaining is going to require input from the WG. It seems that
the XML schema in the document violates the "unique particle attribution rule".
Apparently the Schema validator Sai and I used didn't enforce this rule.

So what is the unique particle attribution rule? It's more or less eqvuvalent
to requiring the grammar be processable with an LALR(1) parser. A reasonable
explanation of it can be found here:

    http://msdn.microsoft.com/en-us/library/ms187822.aspx

It should be noted that this requirement is unique to XML Schema. There is
no similar requirement in RNG.

So what part of the Schema violates this rule? It's the command complex type,
which is the type used for action and control elements:

  <xsd:complexType name="command">
    <xsd:sequence>
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <xsd:element ref="str"/>
        <xsd:element ref="num"/>
        <xsd:element ref="list"/>
        <xsd:element ref="tag"/>
        <xsd:element ref="displaydata"/>
        <xsd:element ref="comment"/>
        <xsd:any namespace="##other" processContents="lax"/>
      </xsd:choice>
      <xsd:element ref="test" minOccurs="0" maxOccurs="1"/>
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <xsd:element ref="control"/>
        <xsd:element ref="action"/>
        <xsd:element ref="displayblock"/>
        <xsd:element ref="displaydata"/>
        <xsd:element ref="comment"/>
        <xsd:any namespace="##other" processContents="lax"/>
      </xsd:choice>
    </xsd:sequence>
    <xsd:attribute use="required" name="name" type="identifier"/>
  </xsd:complexType>

So in a fragment like

  <action name="stop">
    <comment>This is a comment</comment>
  </action>

does the <comment> element match the first <xsd:element ref="comment"/> 
reference the second? It's ambiguous, and XML Schema doesn't allow that.

So what do we do about this? There are basically four options:

(1) Drop the use of XML Schema and just have an RNG grammar.

(2) Remove the ability to have displaydata, comments, and elements from other
    namespaces appear in a command element after the test clause. This means
    something like

    <control name="if">
      <test name="header">
        <tag>is</tag>
        <str>Sender</str>
        <str>owner-ietf-mta-filters(_at_)imc(_dot_)org</str>
      </test> 
      <action name="fileinto">
        <str>filter</str>
      </action> <comment>move to "filter" mailbox</comment>
    </control>

    is no longer valid. It would have to be written as:

    <control name="if">
      <test name="header">
        <tag>is</tag>
        <str>Sender</str>
        <str>owner-ietf-mta-filters(_at_)imc(_dot_)org</str>
      </test> 
      <action name="fileinto">
        <str>filter</str>
        <comment>move to "filter" mailbox</comment>
      </action>
    </control>

(3) Switch to using XML comments instead of <comment> elements. Note that
    this addresses the issue for comments only; we'd still have to drop the
    ability to have material from other namespaces or displaydata appear
    after the test clause.

(4) Use a wrapper element to disambiguate the schema. This would mean
    writing something like this:

    <control name="if">
      <test name="header">
        <tag>is</tag>
        <str>Sender</str>
        <str>owner-ietf-mta-filters(_at_)imc(_dot_)org</str>
      </test> 
      <action name="fileinto">
        <str>filter</str>
      </action>
      <postamble>
        <comment>move to "filter" mailbox</comment>
      </postamble>
    </control>

    A single added wrappper is sufficient, but for symmetry it might arguably
    be better to have two of them:

    <control name="if">
      <preamble>
        <comment>Test to see if it's from the Sieve list</comment>
      </preamble>
      <test name="header">
        <tag>is</tag>
        <str>Sender</str>
        <str>owner-ietf-mta-filters(_at_)imc(_dot_)org</str>
      </test> 
      <action name="fileinto">
        <str>filter</str>
      </action>
      <postamble>
        <comment>move to "filter" mailbox</comment>
      </postamble>
    </control>

    Of course the element name(s) I've chosen can be changed, as long as
    the two are different.

Unfortunately, every one of these options is problematic in some way:

(1) XML Schema is the only validation mechanism available in some
    environmentts.

(2) Not allowing these elements grots up the process of conversion to
    XML and limits flexibility, especially in regards to inclusion of
    material from other namespaces.

(3) A conforming stylesheet processor is allowed to silently drop comment
    nodes, meaning only a subset of processors will be able to handle
    the conversion process.

(4) THe additional elements are, well, ugly.

My personal preference (and I believe it is Sai's as well because it was his
idea) is (4). And I prefer to add two wrappers, not one. The additional
elements are ugly, but this gives us the most flexibility and doesn't lose any
capabilities.

But this needs to be a WG decision, so ... comments?

                                Ned
_______________________________________________
sieve mailing list
sieve(_at_)ietf(_dot_)org
https://www.ietf.org/mailman/listinfo/sieve

<Prev in Thread] Current Thread [Next in Thread>