Learn XML Schema by Example: 2 Polymorphism
In the previous blog, Learn XML Schema by Example: 1. Complex type , I introduced the very simple idea of ComplexType in Schema. In this blog, I am going to introduce idea of polymorphism which is one of the very important concept in Object orientation. As shown in the above figure, I need Address to be replaced by AUAddress or USAddress in the instance xml file. All the Address, USAddress and AUAddress are complex types in the XML schema. These types are defined in the address.xsd file as shown in the following code. <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns="http://www.ojitha.org/address" targetNamespace="http://www.ojitha.org/address" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="AUAddress"> <xs:complexContent> <xs:extension base="Address"...