This section describes a tutorial example on how to use elements declared with datatypes redefined with 'redefine' components.
In the previous section, we wrote a new version of "address_us.xsd" called "address_us_redefine.xsd",
which inherited the "addressUs" element declaration, but redefined its datatype "addressUsType".
Now let's try to write a sample XML document, address_us_redefine.xml, that conforms to this new definition.
- Copyright (c) 2013, HerongYang.com, All Rights Reserved.
<street>1 Main Street</street>
If you try to validate this new XML document, address_us_redefine.xml, with the new schema, address_us_redefine.xsd,
it will pass:
But if you try to validate this new XML document, address_us_redefine.xml, with the old schema, address_us.xsd,
it will fail:
>java XsdSchemaValidator address_us.xsd address_us_redefine.xml
Line number: 11
Column number: 11
Message: cvc-complex-type.2.4.d: Invalid content was found
starting with element 'country'. No child element is expected at this point.
Failed with errors: 1