Something wrong with XML Schema <xs:redefine> -
i want redefine complex types existing schema file. when i'm using altova xmlspy reported error. shows:
redefining type definition 'address' must extension or restriction of itself. error location: xs:schema / xs:redefine / xs:complextype / xs:complexcontent / xs:extension / @base details src-redefine.5: redefining type definition 'address' must extension or restriction of itself.
and source code has have <xs:extension>
part in it.
<xs:redefine schemalocation="reusable.xsd"> <xs:complextype name="address"> <xs:complexcontent> <xs:extension base="address"> <xs:sequence> <xs:element name="postcode"/> </xs:sequence> </xs:extension> </xs:complexcontent> </xs:complextype> </xs:redefine>
i can't figure out what's wrong it. here's source code of schema files.
source.xsd
<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" targetnamespace="we:love:xml:schemas:but:we:hate:namespaces"> <xs:redefine schemalocation="reusable.xsd"> <xs:complextype name="address"> <xs:complexcontent> <xs:extension base="address"> <xs:sequence> <xs:element name="postcode" /> </xs:sequence> </xs:extension> </xs:complexcontent> </xs:complextype> </xs:redefine> <xs:element name="resume"> <xs:annotation> <xs:documentation>comment describing root element</xs:documentation> </xs:annotation> </xs:element> </xs:schema>
thanks in advance.
reusable.xsd
<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:xf="we:love:xml:schemas:but:we:hate:namespaces" targetnamespace="we:love:xml:schemas:but:we:hate:namespaces" elementformdefault="qualified" attributeformdefault="unqualified"> <xs:complextype name="address"> <xs:annotation> <xs:documentation>this type meant represent generic address. consists of unlimited number of street addresses, city, state or province, postal code, , country. suggested if need be, on transform use conditional processing based on country element country specific layouts of addresses.</xs:documentation> </xs:annotation> <xs:sequence> <xs:element name="streetaddress" type="xs:string" maxoccurs="unbounded"/> <xs:element name="city"/> <xs:element name="stateorprovince" type="xs:string" minoccurs="0"/> <xs:element name="postalcode" type="xs:string"/> <xs:element name="country" type="xf:countrytype"/> </xs:sequence> </xs:complextype> </xs:schema>
your choice of namespace uri says all. don't want extend "address", want extend "wlxsbwhns:address", prefix wlxsbwhns bound target namespace uri.