Re: A practical use case for a fixed ID attribute? (UNCLASSIFIED)

Classification: UNCLASSIFIED
Roger,

A schema can be written to specify a subset to an existing grammar specified by either an instance or separate schema.  In this case a larger structure may already be defined.  For the sake of argument lets say XHTML.  You need to supply a model for a form that conforms to XHTML and will have many instances.  Lets say that conforming to XHTML is not enough in that your XHTML form must conform to a document instance of XHTML.  This document instance may already have CSS and JavaScript defined specifically for the document structure at hand and so we would not want to supply any changes in the forms generated from a schema that may plug into this XHTML document's structure.  In this case when we write the schema we could define an attribute of type ID with a fixed value to fit into the root element of your form instances where such an element with attribute and value may be required to conform to larger document's existing structure.

Now, lets think outside of HTML.  What if we were writing a schema to generate XML instances that must functionally conform to characteristics of some existing XML instance.  Instances of your schema will be included as parts into the larger prior existing XML instance.  If this larger prior existing instance contains any attributes of type IDREF an error will be thrown if a matching value of attribute type ID is not present.  Since you do not control the larger prior existing schema it may be necessary to limit the values used by that attribute of type IDREF while simultaneously preventing errors.  This can be achieved by making your attribute of type ID fixed with a nominal value so as to avoid unexpected results elsewhere your imported instance is consumed.

These are the only two use cases I could think of off the top of my head, but if I think of any more later today I will send a second email.

Austin



On 12/08/12, "Costello, Roger L."  <costello@mitre.org> wrote:

> Hi Folks,
> 
> In XML Schema 1.1 it is possible to declare an attribute of type ID and fix its value. For example:
> 
> <attribute name="instructor" type="ID" fixed="Professor-Johnson" />
> 
> Yesterday I showed that example to my class and they challenged me on the usefulness of this. 
> 
> I could not think of a single practical use case for a fixed ID attribute.
> 
> Do you have a practical use case for a fixed ID attribute?
> 
> /Roger
Classification: UNCLASSIFIED

Received on Saturday, 8 December 2012 15:47:16 UTC