gda-xml-query and gda-xml-report



Hi all!

I think, that some of the elements in gda-xml-query.dtd and
gda-xml-report.dtd are not well designed. There are elemnets with the
structure

<!ELEMENT element (child1?, child2*, child3?)>. 

Splicing the child2-element-list into the list of single elements is not
a good idea.
It would make the DTD and the application code much clearer, if we
introduce an explicit list-element.

<!ELEMENT element (child1?, child2list?, child3?)>. 
<!ELEMENT child2list (child2)+>. 

What do you, Vivien and Carlos, think about these changes. 

If you agree, it would be nice, if you put the attached new versions
into the gnome-CVS.


Gerhard
<!--      gda-xml-query.dtd
          Copyright (C) 2000 Vivien Malerba
          
          modified July 2000 Gerhard Dieringer
-->

<!ENTITY  % trailer "union|unionall|intersect|minus|sort">
<!ENTITY  % simplevalue "const|field|func">
<!ENTITY  % boolop "and|or|not">
<!ENTITY  % arithop "eq|ne|lt|le|gt|ge">
<!ENTITY  % sqlop "null|like|between|in|exists">
<!ENTITY  % datatype "struct|array|type">

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

<!ELEMENT select (sources?, joinlist?, valuelist?, qual?, (%trailer;)?)>

<!ELEMENT insert (target, dest?, (valuelist|query))>

<!ELEMENT update (target, sources?, joinlist?, (set|setlist), qual?)>

<!ELEMENT delete (target, qual?)>


<!ELEMENT target (table|view)>

<!ELEMENT union     (query)>

<!ELEMENT unionall  (query)>

<!ELEMENT intersect (query)>

<!ELEMENT minus     (query)>

<!ELEMENT dest (field+)>

<!ELEMENT setlist (set+)>

<!ELEMENT set (field,(%simplevalue;))>

<!ELEMENT sources (table|view)*>

<!ELEMENT joinlist (join)+>


<!ELEMENT join (%boolop;|%arithop;)*>
<!ATTLIST join
          type (inner|left|right) "inner"
          left  IDREF #REQUIRED
          right IDREF #REQUIRED>

<!ELEMENT valuelist (value)+>

<!ELEMENT value (%simplevalue;|query)>
<!ATTLIST value
          id    ID     #IMPLIED>


<!ELEMENT qual (%boolop;|%arithop;|%sqlop;)*>

<!ELEMENT sort (column)+>

<!ELEMENT table EMPTY>
<!ATTLIST table
          id      ID       #IMPLIED
          name    NMTOKEN  #REQUIRED
          temp (yes|no) "no">

<!ELEMENT view EMPTY>
<!ATTLIST view
          id      ID       #IMPLIED
          name    NMTOKEN  #REQUIRED>

<!ELEMENT field EMPTY>
<!ATTLIST field
          source IDREF   #REQUIRED
          name   NMTOKEN #REQUIRED
          alias  NMTOKEN #IMPLIED
          group (yes|no) "no">

<!ELEMENT func (field|const|func)*>
<!ATTLIST func 
          name  NMTOKEN #REQUIRED
          alias NMTOKEN #IMPLIED
	  aggregate (yes|no) "no">

<!ELEMENT column EMPTY>
<!ATTLIST column num  NMTOKEN #REQUIRED
                 order (asc|desc) "asc">

<!ELEMENT const EMPTY>
<!ATTLIST const
          value CDATA   #IMPLIED
          alias NMTOKEN #IMPLIED
          type  NMTOKEN #REQUIRED
          null (yes|no) "no">

<!ELEMENT and (%boolop;|%arithop;|%sqlop;)+>

<!ELEMENT or (%boolop;|%arithop;|%sqlop;)+>

<!ELEMENT not (%boolop;|%arithop;|%sqlop;)>

<!ELEMENT eq ((%simplevalue;),(%simplevalue;|query))>

<!ELEMENT ne ((%simplevalue;),(%simplevalue;|query))>

<!ELEMENT lt ((%simplevalue;),(%simplevalue;|query))>

<!ELEMENT le ((%simplevalue;),(%simplevalue;|query))>

<!ELEMENT gt ((%simplevalue;),(%simplevalue;|query))>

<!ELEMENT ge ((%simplevalue;),(%simplevalue;|query))>

<!ELEMENT null (%simplevalue;)>

<!ELEMENT like ((%simplevalue;),(%simplevalue;|query))>

<!ELEMENT between ((%simplevalue;),(%simplevalue;),(%simplevalue;))>

<!ELEMENT in (field,query)>

<!ELEMENT exists (query)>


<!--
************************************************************
-->

<!ELEMENT create (tabledef|viewdef|sequence|indexdef)>

<!ELEMENT drop   (table|view|sequence|index)>



<!--
The following elements should be moved to the database DTD
-->

<!ELEMENT tabledef (fielddef+,primary?,foreignlist?)>
<!ATTLIST tabledef
          id      ID       #IMPLIED
          name    NMTOKEN  #REQUIRED
          temp (yes|no) "no">

<!ELEMENT viewdef (query)>
<!ATTLIST viewdef 
          id      ID       #IMPLIED
          name    NMTOKEN  #REQUIRED>

<!ELEMENT fielddef (%datatype;)>
<!ATTLIST fielddef
          id   ID      #IMPLIED
          name NMTOKEN #REQUIRED
          notnull (yes|no) "no">

<!ELEMENT primary EMPTY>
<!ATTLIST primary
          key IDREFS #REQUIRED>


<!ELEMENT foreignlist (foreign+)>

<!ELEMENT foreign EMPTY>
<!ATTLIST foreign
          key   IDREFS   #REQUIRED
          table NMTOKEN  #REQUIRED
          ref   NMTOKENS #REQUIRED>

<!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 #IMPLIED>

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

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

<!ELEMENT indexdef EMPTY>
<!ATTLIST indexdef
          name    NMTOKEN  #REQUIRED
          table   NMTOKEN  #REQUIRED
          columns NMTOKENS #REQUIRED
          unique  (yes|no) "no">

<!ELEMENT index EMPTY>
<!ATTLIST index
          name    NMTOKEN  #REQUIRED>

<!-- gda-xml-report.dtd
     Copyright (C) 2000 Carlos Perello Marin
                        Gerhard Dieringer
-->

<!ENTITY % query SYSTEM "/home/gmd/xml/dtd/gda-xml-query.dtd">
%query;


<!ENTITY % positionfreq    "first|inside|last|allbutfirst|allbutlast|firstandlast|all">
<!ENTITY % pagefreq        "even|odd|all">
<!ENTITY % linestyle       "none|solid|dash|dot|dashdot|dashdotdot">
<!ENTITY % fontweight      "light|normal|semibold|bold|black">
<!ENTITY % halignment      "standard|left|center|right">
<!ENTITY % valignment      "top|center|bottom">


<!ELEMENT report (reportheader?, pageheaderlist?, dataheader?,  reportdata?, 
                  datafooter?,   pagefooterlist?, reportfooter?)>
<!ATTLIST report
  pagesize        (A3|A4|A5|A6|B3|B4|B5|B6|letter|legal|executive) "A4"
  orientation     (portrait|landscape) "portrait"
  units           (inch|cm|pt)      "cm"
  topmargin       NMTOKEN           "2.5"
  bottommargin    NMTOKEN           "2.5"
  leftmargin      NMTOKEN           "2.5"
  rightmargin     NMTOKEN           "2.5"
  bgcolor         NMTOKENS          "255 255 255"
  fgcolor         NMTOKENS          "0 0 0"
  bordercolor     NMTOKENS          "0 0 0"
  borderwidth     NMTOKEN           "1"
  borderstyle     (%linestyle;)     "none"
  fontfamily      NMTOKEN           "Helvetica"
  fontsize        NMTOKEN           "10"
  fontweight      (%fontweight;)    "normal"
  fontitalic      (yes|no)          "no"
  halignment      (%halignment;)    "standard"
  valignment      (%valignment;)    "center"
  wordwrap        (yes|no)          "no"
  negvaluecolor   NMTOKENS          "255 0 0"
  dateformat      CDATA             "dd.mm.yyyy"
  precision       NMTOKEN           "2"
  currency        CDATA             "EUR"
  commaseparator  (yes|no)          "no"
  linewidth       NMTOKEN           "1"
  linecolor       NMTOKENS          "0 0 0"
  linestyle       (%linestyle;)     "solid"
>

<!ELEMENT reportelementlist   (line|label|special|repfield|picture)+>

<!ELEMENT reportheader (query?,reportelementlist)>
<!ATTLIST reportheader 
  height          NMTOKEN           "2.0"
  newpage         (yes|no)          "no"
>

	
<!ELEMENT reportfooter (query?,reportelementlist)>
<!ATTLIST reportfooter 
  height          NMTOKEN           "2.0"
  newpage         (yes|no)          "no"
>

<!-- the pageheader/-footer are only printed, if both frequency conditions are true
     If the report has only one page, then first and last are both true
     The combination positionfreq="first" pagefreq="even" is never true
-->

<!ELEMENT pageheaderlist (pageheader+)>

<!ELEMENT pageheader (query?,reportelementlist)>
<!ATTLIST pageheader 
  height          NMTOKEN           "2.0"
  positionfreq   (%positionfreq;)   "all"
  pagefreq       (%pagefreq;)       "all"
>


<!ELEMENT pagefooterlist (pagefooter+)>

<!ELEMENT pagefooter (query?,reportelementlist)>
<!ATTLIST pagefooter 
  height          NMTOKEN           "2.0"
  positionfreq   (%positionfreq;)   "all"
  pagefreq       (%pagefreq;)       "all"
>


<!-- the dataheader/-footer ist like a groupheader/-footer for a virtuell group,
     that contains all the data
-->

<!ELEMENT dataheader (query?,reportelementlist)>
<!ATTLIST dataheader 
  height          NMTOKEN           "2.0"
>


<!ELEMENT datafooter (query?,reportelementlist)>
<!ATTLIST datafooter 
  height          NMTOKEN           "2.0"
>


<!ELEMENT reportdata (detail|(groupheader?,reportdata,groupfooter?))>


<!ELEMENT detail (query?,reportelementlist)>
<!ATTLIST detail 
  height          NMTOKEN           "2.0"
>


<!ELEMENT groupheader (query?,reportelementlist)>
<!ATTLIST groupheader 
  height          NMTOKEN           "2.0"
  newpage         (yes|no)          "no"
>


<!ELEMENT groupfooter (query?,reportelementlist)>
<!ATTLIST groupfooter 
  height        NMTOKEN             "2.0"
  newpage       (yes|no)            "no"
>


<!ELEMENT picture EMPTY>
<!ATTLIST picture 
  x             NMTOKEN            #REQUIRED
  y             NMTOKEN            #REQUIRED
  width         NMTOKEN            #REQUIRED
  height        NMTOKEN            #REQUIRED
  size          (cut|scale)        "scale"
  aspectratio   (fixed|float)      "fixed"
  format        NMTOKEN            #REQUIRED
  source        (intern|extern)    #REQUIRED
  data          CDATA              #REQUIRED
>


<!ELEMENT line EMPTY>
<!ATTLIST line 
  x1   		NMTOKEN            #REQUIRED
  y1            NMTOKEN            #REQUIRED
  x2            NMTOKEN            #REQUIRED
  y2            NMTOKEN            #REQUIRED
  linewidth     NMTOKEN            #IMPLIED
  linecolor     NMTOKENS           #IMPLIED
  linestyle     (%linestyle;)      #IMPLIED
>


<!ELEMENT label EMPTY>
<!ATTLIST label 
  text          CDATA              #REQUIRED
  x             NMTOKEN            #REQUIRED
  y             NMTOKEN            #REQUIRED
  width         NMTOKEN            #REQUIRED
  height        NMTOKEN            #REQUIRED
  bgcolor       NMTOKENS           #IMPLIED
  fgcolor       NMTOKENS           #IMPLIED
  bordercolor   NMTOKENS           #IMPLIED
  borderwidth   NMTOKEN            #IMPLIED
  borderstyle   (%linestyle;)      #IMPLIED
  fontfamily    NMTOKEN            #IMPLIED
  fontsize      NMTOKEN            #IMPLIED
  fontweight    (%fontweight;)     #IMPLIED
  fontitalic    (yes|no)           #IMPLIED
  halignment    (%halignment;)     #IMPLIED
  valignment    (%valignment;)     #IMPLIED
  wordwrap      (yes|no)           #IMPLIED
>


<!ELEMENT repfield EMPTY>
<!ATTLIST repfield
  query           IDREF            #REQUIRED 
  value           IDREF            #REQUIRED 
  x               NMTOKEN          #REQUIRED
  y               NMTOKEN          #REQUIRED
  width           NMTOKEN          #REQUIRED
  height          NMTOKEN          #REQUIRED
  datatype        NMTOKEN          #REQUIRED
  bgcolor         NMTOKENS         #IMPLIED
  fgcolor         NMTOKENS         #IMPLIED
  bordercolor     NMTOKENS         #IMPLIED
  borderwidth     NMTOKEN          #IMPLIED
  borderstyle     (%linestyle;)    #IMPLIED
  fontfamily      NMTOKEN          #IMPLIED
  fontsize        NMTOKEN          #IMPLIED
  fontweight      (%fontweight;)   #IMPLIED
  fontitalic      (yes|no)         #IMPLIED
  halignment      (%halignment;)   #IMPLIED
  valignment      (%halignment;)   #IMPLIED
  wordwrap        (yes|no)         #IMPLIED
  dateformat      CDATA            #IMPLIED
  precision       NMTOKEN          #IMPLIED
  currency        CDATA            #IMPLIED
  negvaluecolor   NMTOKENS         #IMPLIED
  commaseparator  (yes|no)         #IMPLIED
>


<!--
  The text attribute of element special is a format string which may contain some
  of the following functions:
  \D  date in format dateformat
  \d  day
  \m  month
  \y  year (yy)
  \Y  year (yyyy)
  \p  page number
  \t  total number of pages
-->

<!ELEMENT special EMPTY>
<!ATTLIST special
  text            CDATA               #REQUIRED 
  x               NMTOKEN             #REQUIRED
  y               NMTOKEN             #REQUIRED
  width           NMTOKEN             #REQUIRED
  height          NMTOKEN             #REQUIRED
  bgcolor         NMTOKENS            #IMPLIED
  fgcolor         NMTOKENS            #IMPLIED
  bordercolor     NMTOKENS            #IMPLIED
  borderwidth     NMTOKEN             #IMPLIED
  borderstyle     (%linestyle;)       #IMPLIED
  fontfamily      NMTOKEN             #IMPLIED
  fontsize        NMTOKEN             #IMPLIED
  fontweight      (%fontweight;)      #IMPLIED
  fontitalic      (yes|no)            #IMPLIED
  halignment      (%halignment;)      #IMPLIED
  valignment      (%halignment;)      #IMPLIED
  wordwrap        (yes|no)            #IMPLIED
  dateformat      CDATA               #IMPLIED
>


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