> From: Ray Denenberg [mailto:[log in to unmask]]
> Sent: Wednesday, March 27, 2002 03:46 PM
>
> The question of required elements has come up in
> discussion here. Specifically, among the top-level
> 19 elements (title, name, type of resource, etc.)
> none is mandatory. Nor do we propose that any
> among these be mandatory, but that leaves the
> possibility of empty records. An easy way out is
Empty records are fine and preferable. The reason
is that it allows you to define a "template" for a
record, for example:
<?xml version="1.0" ?>
<mods xmlns="..." xmlns:xsi="..." xsi:schemaLocation="..." />
Now I can read this "template" into the XMLDOM and start
adding elements and attributes to build the rest of my
record. Certainly, I could build the document element
myself but it's nice to have template files hanging
around that have the appropriate namespaces and such
already defined. As soon as I add an element or attribute
I can use the XMLDOM validate() function to ensure I'm
building the record according to the defined DTD or Schema.
Also, in my template I may decide that certain elements are
required, so I add them into the template to save programming
time.
A problem that I have is that MODS defines no recordset or
dataset element. With MARC21 for example, I can specify
multiple records in a single MARC file. The way MODS is
specified is that it only defines a record. You should
consider having the <mods> element as the recordset or
dataset element and have a separate <record> element.
This would allow placing multiple MODS records into one
XML data file. For example:
<?xml version="1.0" ?>
<mods ...>
<record ... />
<record ... />
</mods>
The recordset or dataset level element should allow zero
or more records, like the record element allows zero or
more elements. For a single record you now have introduced
an additional node level but that doesn't bother me because
the abstraction allows me to easily determine how many records
are in the dataset by looking at the number of child elements,
in the XMLDOM, that are attached to the document node <mods>.
BTW, it is preferable to not specify encoding="utf-8" on
your XML declaration. Per the XML standard, if the XML
parser reads in the BOM for UTF-8 or UTF-16 then it will
know the appropriate encoding, in absence of a BOM and
the encoding attribute, UTF-8 will be assumed.
Andy.
|