Referencing in XML for the IVO

Arnold Rots arots at head.cfa.harvard.edu
Wed Nov 30 06:51:20 PST 2005


I agree in principle and generally prefer to use elements because they
allow stronger validation, but in this case I think attributes are
more appropriate - if for no other reason than that derivation from
such a base class becomes messier.  It would become something like (in
quick-and-dirty language):

<complexType baseClassType>
  <complexContent>
    <choice>
      <Id/>
      <Xlink type=simple href=.../>
      <Content>                      <---
        ...                           content would go here in extensions
      </Content>                     <---
    </choice>
  </complexContent>
</complexType>

On the one hand, I would like to be able to enforce that either an
idref, or an href, or content be available, but on the other hand I
think it is acceptable to state that if an element is truly empty (no
idref, no href, no content) its default value will be UNKNOWN which is
a recognized value in STC meaning that it's up to the client to
reject it or to decide what is a reasonable (default) value.

Cheers,

  - Arnold


Paul Harrison wrote:
[ Charset ISO-8859-1 unsupported, converting... ]
> Patrick Dowler wrote:
> > With respect to the following, is there a way to say that at least one
> > of the attributes must be present? Otherwise, a validating XML 
> > parser cannot fully validate the document and client code has to
> > check for null all over the place. The presence of required elements
> > and attributes is really the most vanilla for of validity checking, and
> > we are going to give that up if everything is nillable :-(
> > 
> > I realise that even then, use of xlink makes it impossible for the
> > parser to fully validate... but it would be nice to know (from successfully
> > parsing) that the document appears to be valid (assuming external 
> > references via xlink are to the correct kind of thing).
> > 
> 
> 
> I think that this does illustrate a general design issue in our schema - 
> use elements in preference to attributes where the underlying data 
> structure is a choice
> as then the parser can validate that one of the choice elements is 
> present - this cannot be done with optional attributes. Using more 
> elements to represent things instance documents look even uglier to the 
> human reader, but let's face it, the prime purpose of xml is for 
> computers to read.
> 
> 
> -- 
> Paul Harrison
> ESO Garching
> www.eso.org
> 
--------------------------------------------------------------------------
Arnold H. Rots                                Chandra X-ray Science Center
Smithsonian Astrophysical Observatory                tel:  +1 617 496 7701
60 Garden Street, MS 67                              fax:  +1 617 495 7356
Cambridge, MA 02138                             arots at head.cfa.harvard.edu
USA                                     http://hea-www.harvard.edu/~arots/
--------------------------------------------------------------------------



More information about the dm mailing list