Redefining Old Datatypes - Errors

This section describes a tutorial example of incorrect usages of 'redefine' components on changing existing datatypes.

One common error on using "redefine" components is that the redefined datatype uses a name different than the base datatype. Here is a sample schema document, address_redefine_error.xsd, that has this type of errors:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="">
 - Copyright (c) 2002-2013 All Rights Reserved.

 <xsd:redefine schemaLocation="address_us.xsd">
    Modifying the "addressUsType" definition

  <xsd:complexType name="addressOverseaType">
    <xsd:extension base="addressUsType">
      <xsd:element name="country" type="xsd:string"/>

  <xsd:element name="addressOversea" type="addressOverseaType"/>


Here is the error message reported by the schema checker program,

herong> java XsdSchemaChecker address_redefine_error.xsd

   Line number: 18
   Column number: 41
   Message: src-redefine.5.b.d: 'extension' does not have a 'base'
   attribute that refers to the redefined element,
   ',addressOverseaType'. <complexType> children of <redefine>
   elements must have <extension> or <restriction> descendants,
   with 'base' attributes that refer to themselves.

Failed with 1 errors.

Table of Contents

 About This Book

 Introduction to XML Schema

 XML Editor and Schema Processor - XMLPad

 Java API for XML Processing - JAXP

 JAXP - XML Schema (XSD) Validation

 Xerces2 Java Parser - Java API of XML Parsers

 Using Xerces2 Java APIs

 XML Schema Language - Basics

 Introduction of XSD Built-in Datatypes

 "string" and Its Derived Datatypes

 "decimal" and Its Derived Datatypes

 "dateTime" and Its Related Datatypes

 Miscellaneous Built-in Datatypes

 Facets, Constraining Facets and Restriction Datatypes

 "simpleType" - Defining Your Own Simple Datatypes

 Complex Element Declaration

 Identity-Constraints: unique, key and keyref

 Assertion as Custom Validation Rules

 XML Schema Location and Namespace in XML Documents

 Overriding Element Types in XML Documents

Linking Multiple Schema Documents Together

 Schema Component Reuse - "include", "redefine" or "import"

 Including Old Schema Documents - "include" Component

 Including Old Schema Documents - Examples

 Including Old Schema Documents - Errors

 Redefining Old Datatypes - "redefine" Component

 Redefining Old Datatypes - XML Examples

Redefining Old Datatypes - Errors

 Importing Declarations Across Namespaces - "import" Component

 Importing Declarations Across Namespaces - Examples

 Using Elements Declared in Different Namespaces

 Using Elements Declared in Different Namespaces - Errors


 Archived Tutorials


 Full Version in PDF/EPUB