<!--
Unlike CDL, we allow dimensions, variables and global
attributes to occur in any sequence.  We only require
dimensions be defined before they are used.
-->
<!ELEMENT netcdf (name,(dim|var|att)*)>

<!--
"Dimensions" require only the name and size.  "Size"
should be a positive number or "unlimited".

The name of each dimension should be unique, but this is
not enforced by the XML grammar.

Since NetCDF dimension names can include underscores, we
can't use them as an XML ID... and we can't assume that
nobody would ever use both foo_bar and foo-bar as dimension
names in a single CDL.  So for now we use an arbitrary name
in ncxdump, and encourage people to use meaningful names in
their xCDL.
-->
<!ELEMENT dim (name,size)>
<!ATTLIST dim id ID #REQUIRED>

<!--
"Variables" require the type and name.  The referenced
dimensions must already be defined, and as usual any
unlimited dimension must be the first one listed.

The name of each variable should be unique, but this is
not enforced by the XML grammar for the reasons discussed
above.
-->
<!ELEMENT var (type,name,att*,data?)>
<!ATTLIST var dims IDREFS #IMPLIED>

<!--
Attributes can have global scope, or linked to a specific
variable.  The name must be unique within its scope, but
this is not enforced by the XML grammar.

Attributes must specify a type.  This type is independent
of the scoping variable.

Attributes may have multiple values.
-->
<!ELEMENT att (type,name,value)>

<!--
Data with an "unlimited" dimension is always grouped
into records to make life easier for the parser by making
it easy to determine when to allocate memory... and how
much to allocate.
-->
<!ELEMENT data (record+|value)>
<!ELEMENT record (value)>

<!--
Some miscellaneous targets.  They were attributes in
an earlier version of this DTD, but were extracted to
provide flexibility.
-->
<!ELEMENT name (#PCDATA)>
<!ELEMENT size (#PCDATA)>
<!ELEMENT type (#PCDATA)>

<!--
This element describes legacy NetCDF formatted data.
It is a simple comma-delimited list.

Because a comma-delimited list limits the usefulness of
the XML tools, it is likely that additional elements will
be defined in the future.  (e.g., <vector> or <2d-array>)
However, since support is forever we want to take a
conservative approach towards adding new elements. :-)
-->
<!ELEMENT value (#PCDATA)>

