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: Datatypes


Attached is an updated proposal for how TREX should handle datatypes.  This
proposal allows users to define datatypes.

James

Title: Datatypes in TREX
  1. A datatype provides three operations:
  2. In addition to a symbol space for patterns, a grammar has a symbol space for datatypes.
  3. There is an additional attribute datatypeNamespace like the current ns attribute, which is allowed on every element and is inherited.
  4. The ns attribute is renamed to defaultNamespace.
  5. A datatype is referenced using an NCName. The lookup process first looks in the datatype symbol space for the current grammar, and then in the namespace defined by the datatypeNamespace attribute.
  6. Users can derive datatypes in two ways:
  7. The same syntax is used to specify a datatype in all contexts where a datatype is required. I will call this a datatypeSpec. A datatypeSpec is choice of
  8. The data element uses a datatypeSpec to specify the datatype matched by the pattern.
  9. The data element can have either a key or a keyRef attribute that specifies identity constraints.
  10. TREX defined a namespace URI containing two datatypes: string and normalizedString. This namespace URI is the default for the datatypeNamespace attribute.
  11. The string element is removed.
  12. The anyString element is renamed to text.
  13. A grammar element can have any number of datatype children in addition to define and start children. The datatype element creates a definition in the datatype symbol space of the grammar element. The definition binds the NCName specified by the name attribute to a datatype specified by a datatypeSpec.
  14. The define element is renamed to pattern.
  15. Provide some way to specify a white space separated list of tokens matching some pattern, perhaps by extending oneOrMore and zeroOrMore.

Here's a fragment of a TREX pattern for TREX as it would be with this proposal:

<grammar datatypeNamespace="http://www.w3.org/2001/XMLSchema-datatypes">

<pattern name="datatypeSpec">
  <choice>
    <attribute name="type">
      <data type="NCName"/>
    </attribute>
    <element name="setParams">
      <ref name="datatypeSpec"/>
      <oneOrMore>
        <element name="param">
          <text/>
        </element>
      </oneOrMore>
    </element>
    <element name="enum">
      <ref name="datatypeSpec"/>
      <oneOrMore>
        <element name="value">
          <text/>
        </element>
      </oneOrMore>
    </element>
  </choice>
</pattern>

<-- Allowed as a child of grammar. -->

<pattern name="datatype">
  <element name="datatype">
    <attribute name="name">
      <data type="NCName"/>
    </attribute>
    <ref name="datatypeSpec"/>
  </element>
</pattern>

<-- Allowed as a pattern. -->

<pattern name="data">
  <element name="data">
    <optional>
      <choice>
        <attribute name="key">
          <data type="NCName"/>
        </attribute>
        <attribute name="keyRef">
          <data type="NCName"/>
        </attribute>
      </choice>
    </optional>
    <ref name="datatypeSpec"/>
  </element>
</pattern>

</grammar>

Here's how Kawaguchi-san's example might look:

<grammar datatypeNamespace="http://www.w3.org/2001/XMLSchema-datatypes">

<datatype name="localTime">
  <setParams type="time">
    <param name="pattern">[0-9]+:[0-9]+:[0-9]+</param>
  </setParams>
</datatype>

<start>
  <element name="appointment">
    <data>
      <setParams type="localTime">
	<param name="minInclusive">08:00:00</param>
	<param name="maxInclusive">20:00:00</param>
      </setParams>
    </data>
  </element>
</start>

</grammar>

Issues

  1. For the key and keyRef attributes on data, we need a definition of datatype identity. We can resolve a datatype into a primitive datatype name, a set of parameters and a set of values. One possibility is to say that two datatypes are the same if all these three things are the same. Should datatype parameters be considered as typed for the purposes of determining identity?
  2. Can setParams override parameters that the base datatype specifies?
  3. Does datatype have a combine attribute? If so, what values can it take? At least it should allow replace.
  4. Should enum be called enumeration instead?
  5. Should ns be renamed to targetNamespace instead of defaultNamespace?
  6. Can you use setParams to derive from a datatype defined by enum?
  7. Should any other datatypes be built into TREX other than string and normalizedString?
  8. How should whitespace-separated lists of datatypes be supported, if at all?

$Id: datatypes.html,v 1.4 2001/05/12 07:46:01 jjc Exp $



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


Powered by eList eXpress LLC