OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] per class attributes and per instance attributes

[ Lists Home | Date Index | Thread Index ]

I am defining classes and sub-classes. I have to specify attributes to
all the elements in the classes.
The values of some attributes will be same for all the elements in a
particular class and values of some attributes will be different for
each element although they are in the same class.

How do I define them in xml schema (XSD)? 

-Mangesh

-----Original Message-----
From: Rick Jelliffe [mailto:rjelliffe@allette.com.au] 
Sent: Monday, April 17, 2006 6:58 PM
To: xml-dev@lists.xml.org
Subject: Re: [xml-dev] per class attributes and per instance attributes

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

-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://www.oasis-open.org/mlmanage/index.php>






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS