> From: Metadata Object Description Schema List
> [mailto:[log in to unmask]] On Behalf Of Karen Coyle
> Sent: 22 July, 2005 13:24
> To: [log in to unmask]
> Subject: [MODS] Getting rid of attributes?
>
> .. would it be enough to make author and type sub-elements of
> the topic elements, i.e.
>
> <mads xsi:schemaLocation="http://www.loc.gov/mads/mads.xsd">
> <authority>
> <topic>Computer programming
> <authorityList>lcsh</authorityList>
> </topic>
> </authority>
> <related>
> <topic>Computers
> <relatedType>broader</relatedType>
> <authorityList>lcsh</authorityList>
> </topic>
> </related>
> etc.
>
> And if that's all it would take, what is the downside of
> using this style? Are there particular advantages to using
> attributes vs. elements?
What you have proposed is what is called a Mixed Model where you
mix text and elements freely, like you do in HTML. I wouldn't
recommend using a Mixed Model for any XML based grammar. However,
you can turn any Mixed Model into regular model by the declaration
of a few more elements. So your example might become:
<mads xsi:schemaLocation="http://www.loc.gov/mads/mads.xsd">
<authority>
<topic>
<label>Computer programming</label>
<authorityList>lcsh</authorityList>
</topic>
</authority>
<related>
<topic>
<label>Computers</label>
<relatedType>broader</relatedType>
<authorityList>lcsh</authorityList>
</topic>
</related>
</mads>
There is an upside to using element only based XML grammars in that
you can put your XML grammar into RDF by using the striping method.
So given my altered example, you could just wrap that XML with
<rdf:RDF xmlns:rdf="..."> ... </rdf:RDF> thus <mads> becomes an RDF
class.
There is one issue with using attributes that you need to be aware of.
Attribute values are normalized according to the XML specification,
thus leading, trailing and multiple embedded spaces are collapsed and
attribute values are not affected by xml:space attribute.
Andy.
|