[xsd-users] Is it possible using XSD to do this?

Anpao Chou ac22750085 at yahoo.com
Fri Aug 22 17:40:31 EDT 2008


Hi Boris:

        Thank you so much for the quick/smart way doing this,  I appreciate it very much.

Thanks Again  and Best Regards,




----- Original Message ----
From: Boris Kolpackov <boris at codesynthesis.com>
To: Anpao Chou <ac22750085 at yahoo.com>
Cc: xsd-users at codesynthesis.com
Sent: Friday, August 22, 2008 1:30:58 PM
Subject: Re: [xsd-users] Is it possible using XSD to do this?

Hi Anpao,

Anpao Chou <ac22750085 at yahoo.com> writes:
      
>      <?xml version="1.0"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>     <xs:element name="try">
>         <xs:complexType>
>             <xs:sequence>
>             <xs:element name="try_1" type="xs:string"/>
>             <xs:element name="try_3" type="xs:string"/>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
> </xs:schema>
> 
> 
>      Added a new interger element try_2 before the element try_3 to the 
>      new schema file newtry.xsd

There is no support for the general case of upgrading XML instances
to conform to a new schema. I doubt such support can be implemented
at all since the generated code has no knowledge of the values that
should be used in new elements/attributes or their cardinalities.

However, if you first change your schemas in a backwards-compatible way
(that is, all new elements and attributes are made optional) then you 
can read the old XML documents with the new generated code, set values
for the new elements/attributes using the object model, and serialize
it back to XML in the new format. After you have migrated all your XML 
documents using this approach you can change the schema again to make
the new elements and attributes non-optional. 

Boris



      


More information about the xsd-users mailing list