Hello,

I'm trying to validate some xml files like the following example against a xml 
schema.

<?xml version="1.0" encoding="UTF-8" ?> 
<tag 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
    xmlns:ns="ns" 
    xsi:schemaLocation="ns ns.xsd" 
    xsi:type="ns:type">
</tag>

The parser reports an error:

Message:Unknown element 'tag'

My understanding of the XML Schema standard is, that it's possible to switch
to lax assessment for the element-tag. This would validate the element
against the complex type ns:type defined in the schema file named ns.xsd.
My understanding is based upon Xml Schema Part: 1 §5.2 (1) and §3.3.4
(Validation Rule: Schema-Validity Assessment (Element)).

§5.2 http://www.w3.org/TR/xmlschema-1/#validation_outcome
§3.3.4 http://www.w3.org/TR/xmlschema-1/#c-td

If my understanding is correct, is it possible to get this behavior with
the current Xerces-C version without ignoring the error (which means
ignoring all non-fatal errors) ?

Xerces-J 2 doesn't issue an error. I didn't try any other parser.

The reason why I don't have a global element defined in the schema file is,
that I'm reusing existing schema files. Defining a new schema file which
declares the global elements isn't desirable, because the whole application
should be extensible without modifing additional schema files. (I try to
keep the number of required changes for extending the application to a
minimum.)

The example I showed is simplified, in reality I'm using many schema files
which all declare there own complex types. The type of the root element
can be of any of these types. 

If a new schema file is added, the old xml files still remain valid. New xml
files are created with the new xml namespace and schema location added.
(The application which creates the xml files knows all schema files.)

Regards,
Bernhard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to