Using Elements Declared in Different Namespaces - Errors

This section describes a tutorial example of incorrect usages of imported element declarations from a different namespace.

One common error on using elements declared in different namespaces is that the element name is not prefixed with the correct namespace. Here is a sample schema document, .xsd, that has this type of errors:

<?xml version="1.0"?>
<!-- xhtml_import_error.xml
 - Copyright (c) 2013,, All Rights Reserved.

 <title>XML Schema Tutorials</title>
 <author>Herong Yang</author>

 <p>What is XML Schema? ...</p>
 <pre>... schema code ...</pre>


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

>java XsdSchemaValidator xhtml_import.xsd xhtml_import_error.xml
   Line number: 10
   Column number: 5
   Message: cvc-complex-type.2.4.a: Invalid content was found 
   starting with element 'p'. One of 
   "":ul}' is expected.

Failed with errors: 1

Last update: 2013.

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 API

 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



 PDF Printing Version