G
Grant Robertson
I am only just learning about schema basics. I am trying to understand
some fundamental principles about what can be specified within a schema.
If I define an enumerated list of values for an attribute in the root
element, is it then possible to limit which child elements may appear
depending on the value of that attribute? This enumerated attribute would
be used to specify a sub-type for this particular instance of a document.
For instance, if my document sub-type is "Table of Contents" then the
document may only contain designated "Table of Contents" type elements.
However, if the document sub-type is specified as "Index" then the only
type of elements that may appear are those associated with the "Index"
document sub-type. Basically, I want to have different sub-types of
documents that can only contain specific types of information but all
within the same root level doctype and schema.
I guess I could always accomplish this by simply specifying a limited set
of first level child elements specifying that only one of them may
appear. But I think I want to do this by using an attribute of the root
element instead.
I know I could also accomplish this by simply creating independent
schemas, each with their own independent doctype and possible elements.
However, I want to keep all of this within one schema.
Thanks for any assistance.
some fundamental principles about what can be specified within a schema.
If I define an enumerated list of values for an attribute in the root
element, is it then possible to limit which child elements may appear
depending on the value of that attribute? This enumerated attribute would
be used to specify a sub-type for this particular instance of a document.
For instance, if my document sub-type is "Table of Contents" then the
document may only contain designated "Table of Contents" type elements.
However, if the document sub-type is specified as "Index" then the only
type of elements that may appear are those associated with the "Index"
document sub-type. Basically, I want to have different sub-types of
documents that can only contain specific types of information but all
within the same root level doctype and schema.
I guess I could always accomplish this by simply specifying a limited set
of first level child elements specifying that only one of them may
appear. But I think I want to do this by using an attribute of the root
element instead.
I know I could also accomplish this by simply creating independent
schemas, each with their own independent doctype and possible elements.
However, I want to keep all of this within one schema.
Thanks for any assistance.