Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML schema - backward compatible 1

Status
Not open for further replies.

bond001

Programmer
Aug 19, 2007
1
US
Hello everyone,
How should I re-design XML schema in this scenerio?
Lets say my intial version (1.0) has element
<Sickness>Cold</sickness>
My new vesrion needs adding a sequence of properties like
<sickness>
<type>Contagious</type>
cold
</sickness>

1) Should I care about backward compatibility when I re-desin my schema?

2) Should I change schema and say "cold" as another new element?

My new schema looks like folowing
<complextype name="sicktype" mixed="true">
<sequence>
<element name="type" type="string/>
</sequence>
</complextype>

Is the above OK?

Thanks in advance
 
1) It's a legitimate concern on your part.
2) No need (as well reflected in your new schema)

[3] Just add a minOccurs="0" to make it backward compatible.
[tt]
<complextype name="sicktype" mixed="true">
<sequence>
<element name="type" type="string[red]"[/red] [blue]minOccurs="0"[/blue] />
</sequence>
</complextype>
[/tt]
 
Amendment

[3'] Forgotten to correct another original typo.
[tt]
<complex[red]T[/red]ype name="sicktype" mixed="true">
<sequence>
<element name="type" type="string" minOccurs="0" />
</sequence>
</complex[red]T[/red]ype>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top