change the question slightly maybe...schemas, leveraging their object orientedness??

This is a yes or no question.  Just a little long on the xml explaining....

XSD 1....
<complexType name="Address">
    <sequence><element name="name" type="string"/></sequence>
</complexType>

<element name="PurchaseOrder">
    <complexType><sequence><element name="shipTo" 
type="Address"/></sequence></complexType>
</element>

XSD 2...
<complexType name="MyExtendedAddress">
   <complexContent>
      <extension base="XSD1:Address">
         <sequence>
             <element name="state" type="string"/>
          </sequence>
      </extension>
   </complexContent>
</complexType>

XML 1
<PurchaseOrder>
   <shipTo xsi:type="xsd2:MyExtendedAddress">
        <name>Something</name>
         <state>CO</state>
    </shipTo>
</PurchaseOrder>

A program that only has the old XSD1 should only get notified of the 
name, not the state when XML 1 comes in.  Is that correct???  YES or NO

thanks,
dean
 


Dean Hiller wrote:

> Anybody? please??
> thanks,
> dean
>
> Dean Hiller wrote:
>
>>
>> If I have some xml implementating schema A.xsd
>>
>> <superclass>
>>    <someElement/>
>> </superclass>
>>
>> And then I write B.xsd which extends A.xsd and the xml looks 
>> something like this
>> <subclass xmnls="......A.xsd">
>>     <someElement/>
>>     <anAddedElement/>
>> </subclass>
>>
>> BUT, I must be missing something.  There is now a program A which 
>> only knows about A.xsd.  It should be able to receive the xml that 
>> adheres to B.xsd and just skip the unknown elements and only deal 
>> with the known ones(ie someElement).  The problem is there seems to 
>> be nothing to tell the parser that subclass extends superclass unless 
>> you know of B.xsd.
>>
>> I thought the idea of extensions was object-orientedness.  The 
>> subclass should be able to be read by program A as the superclass.  
>> (ie. program A knows about a car, and we created a Ford car, so 
>> program A can still see it as a car).  I am afraid that a parser will 
>> puke at this since it does not adhere to A.xsd.  There must be 
>> something else in the xml I am missing?????
>>
>> Also, how would I write the xsd and xml for this?  I wish the 
>> tutorial explained more in this area.  I would say this is by far the 
>> most important part of xsd's.  Extension without breaking previous 
>> programs. Previous programs just ignore additional data.
>> thanks,
>> dean
>>
>
>

Received on Saturday, 18 October 2003 15:14:53 UTC