Schema Question

Arnold, Curt Curt.Arnold at hyprotech.com
Thu Dec 2 16:36:39 GMT 1999


Steven Livingstone wrote
>><element_properties>
>><color>red</color>
>><mixed_with_na>green</mixed_with_na>
>>Is there a way to specify a variable for the element name, but set it's
>>type, say, to string so that any element created under
<element_properties>
>>could be called anything but follow predetermined validation ?


The concepts of archetypes in the W3C Schema draft were motivated (at least
in my interpretation) by the desire to do something like what you suggested.
The classic would be to create an Address archetype and use it to define
ShipTo and Billing elements that have the same content model.

However, this does not allow a document author to make up a new element name
and have the parser mystically figure out it should be an address (or
whatever) and validate it.  The list of all the acceptible elements must be
enumerated in the schema. (I could be wrong my interpretation on this
however).

I guess if you consider an archetype as being an element without a name, you
could allow an archetype to appear in a content model and then any child
element could be validated against the content model.  However, choosing
between two potential archetypes (say in a choice of archetypes or a
sequence with optional archetypes) may require you to look at their content
to determine what archetype applies.  I think this adds too much complexity
to schema validation for its value.

If you really want to do this (and to validate), I think that you let
"element_properties" have any content and then use an XSLT (or something
else) determine if the content of element_properties matches your pattern.

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list