W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2003

make it object-oriented

From: Dean Hiller <dhiller@avaya.com>
Date: Mon, 20 Oct 2003 15:46:39 -0600
Message-ID: <3F9457BF.2000205@avaya.com>
To: www-xml-schema-comments@w3.org

I found out recently that xsd(at least in my eyes) is not 
object-oriented.  It doesn't support information hiding very well as in 
a superclass hides it's subclass's fields and methods.  Only 
superclass's data is seen.  Information hiding is one of the principles 
of OO.

Concrete example....
I ran into a standard and I needed to extend it, but since they didn't 
prepare for that with the "any" wildcard in the standard, I couldn't.  I 
thought that xsd was object-oriented and I could just define a new type 
to hide the info in.  This way older programs would not be notified of 
the new field as they only had version 1 of the standard.

<car xsi:type="ford">
</car>

Problem with that is it is not valid according to programs that are 
following the standard only, and if their parser did happen to grab the 
additional xsd which they don't want, their program would break because 
it is not prepared for the new feature.

EXPECTED BEHAVIOR....
app using version 1 of standard
app should validate the xml with version 1 of the schema.  Any added 
fields are ignored(because they could be a subclass).  The app doesn't 
care, a car is a car.  If it is a ford or a honda, it won't know the 
difference here.  Any missing fields are reported so that it is known 
that it is an invalid xml.

app using version 1 plus the new addition schema
app should validate the xml with version 1 and the new schema and app 
gets notified of the new fields that a ford has in addition to the 
normal car fields.

This may be a bad example, but in most standards, companies add new 
features to the schema and typically really want a subclass.

Not only this, but XSD's currently don't work as well as they should 
with API's for XML Binding(AXB).  Currently, if I have a car and a ford, 
and I use AXB, I should end up with a Car object, or Ford object 
automatically.  Instead, if we use the any wildcard, I end up with a Car 
object that has private data with more info about the fact that it is a 
ford with all the new features in private data.  This is very annoying. 
 Can we possibly change this??
thanks,
dean
Received on Monday, 20 October 2003 17:51:08 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:39:42 UTC