Re: Antw: Re: revised gda-xml-query.dtd



Hi Vivien,

you wrote:
> ...
> If an XML document is valid (from the DTD) then the provider must try to use
> it, but can still return an error if it is not valid (from a query point of
> view). I don't think it is a problem. There is the same situation with SQL
> specifications, no?
>...

Of course, there may be situations, where a valid XML doc results in an invalid SQL statement, but I think when we decide to use validation, then we should use it as far as possible. This means, that the valid structure should not depend on attribute values, but only on child elements, that can be validated by the parser and we should use attributes only for parameters as for example table names, field names, ...
This implies, that the query element should be changed to 

<!ELEMENT query (select|insert|update|delete|create|drop)>
<!ATTLIST query
          id NMTOKEN #IMPLIED>

and these new elements have to be defined.


> ..
> I'm always open for new ideas, so please tell me :)
> ..

Here is my new proposal for complex type definitions:

<!ENTITY  % datatype "struct|array|type">

<!ELEMENT struct (element+)>

<!ELEMENT element (%datatype;)>
<!ATTLIST element 
          name NMTOKEN #REQUIRED>

<!ELEMENT array (%datatype;)>
<!ATTLIST array
          size NMTOKENS #REQUIRED>

<!ELEMENT type EMPTY>
<!ATTLIST type 
          name NMTOKEN  #REQUIRED
          size NMTOKENS #REQUIRED>

This scheme allows the construction of at least the same data types as the C langage. 

For example:
An array [2,3] of array [4] of struct (i  int4, v  varchar(10), a array[20] of number (10,2)) is defined by:

<array size="2 3">
  <array size="4">
    <struct>
      <element name="i">
        <type name="int" size="4"/>
      </element>
      <element name="v">
        <type name="varchar" size="10"/>
      </element>
      <element name="a">
        <array size="20">
          <type name="number" size="10 2"/>
        </array>
      </element>
   </struct>
  </array>
</array>

As the C-structs are extended to classes in C++ we could also extend this scheme to support OO.



You didn't say anything to the new  generic element 'property'  that can be used to define things as for example sequences, so I repeat it here:

<!ELEMENT sequence (property*)>
<!ATTLIST sequence 
                  name NMTOKEN #REQUIRED>

<!ELEMENT property EMPTY>
<!ATTLIST property
                   name NMTOKEN #REQUIRED
                   value NMTOKEN #REQURED>

Then you can define a sequence as follows:

<sequnce name="seq1">
   <property name="start" value="0"/>
   <property name="inc" value="1"/>
</sequence>


Gerhard






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]