∟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"?>
<book>
<!-- xhtml_import_error.xml
- Copyright (c) 2013, HerongYang.com, All Rights Reserved.
-->
<title>XML Schema Tutorials</title>
<author>Herong Yang</author>
<p>What is XML Schema? ...</p>
<pre>... schema code ...</pre>
</book>
Here is the error message reported by the schema validator program, XsdSchemaValidator.java:
>java XsdSchemaValidator xhtml_import.xsd xhtml_import_error.xml
Error:
Line number: 10
Column number: 5
Message: cvc-complex-type.2.4.a: Invalid content was found
starting with element 'p'. One of
'{"http://www.w3.org/1999/xhtml":p,
"http://www.w3.org/1999/xhtml":pre,
"http://www.w3.org/1999/xhtml":ul}' is expected.
Failed with errors: 1