[
Lists Home |
Date Index |
Thread Index
]
Mangesh Kalbhor said:
> In a XML Schema
>
> How to define a set of per class attributes? And also a set of per
> instance attributes?
Using DTD, you can use a fixed attribute for a class attibute (i.e. an
attribute that is invariant for all instances). You use the keyword #FIXED
and specify them in the DTD not the instance. You use ordinary
(non-fixed) attributes for instance attributes. To make declare these in
sets, you use parameter entities (%).
Using XML Schemas (XSD), you can use a fixed attribute for a class
attibute (i.e. an attribute that is invaraiant for all instances). You use
restrict the value of the attribute to a single value. You use ordinary
(non-fixed) attributes for instance attributes. To make declare these in
sets, you use AttributeGroups. However, you must make sure that your
receiving end uses software that either understands the Post Schema
Validation Infoset (i.e. the instance with all the extra non-XML
information added by the XSD) or, in the case of automatically generated
code from a schema, that the automatic code generator in fact does make
use of the fixed attributes.
Using Schematron there is no way to express class attributes, except the
weak way of requiring that an attribute if specified only has a single
value. Schematron detects the presence or absence of patterns in a
document, it does not augment the original document. (Though smart
software can be written as a layer.)
Using RELAX NG there is no way to express class attributes, except the
weak way of requiring that an attribute if specified only has a single
value. It does not augment the original document. (Though smart software
can be written as a layer.)
XML has been held back for many years by the lack of a processing model.
DTDs were "replaced" by several technologys (XSD, XInclude, XML Base,
Namespaces) but without a processing model they are unreliable. Even with
a processing model, the XSDs usefulness for providing default attribute
values (and other PSVI information) is hibernating until standard APIs are
made (type-augmented SAX, etc.) with wide support.
In making ISO DSDL, we considered whether to have a PSVI (no, because it
works against XML's unity, fixity and commonality) and whether to have a
language for expressing the processing pipeline--Google for Schemamachine
for an example-- (no, because we thought W3C was a better forum for that.)
I hope this is useful,
Rick Jelliffe
|