Altova Mailing List Archives


Re: XML schema validation

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 2/28/2005 3:50:00 PM

Oskar Stuffer wrote:


> I'm using the msv tool which uses xerces to validate a XML document 
> against a XML Schema
> definition.
> 
> This is my XML Schema definition:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>     <xs:element name="AnnoMeseCIG">
>         <xs:simpleType>
>             <xs:restriction base="xs:gYearMonth">
>                 <xs:minInclusive value="2005-01"/>
>             </xs:restriction>
>         </xs:simpleType>
>     </xs:element>
> </xs:schema>
> 
> Parsing this schema an exception is thrown:
> 
> Exception in thread "main" java.lang.ClassCastException

> I tried some online validators that use xerces and they had the same 
> problem with my schema.
> Is there a bug in xerces or is something wrong with my XML Schema 
> definition?

I have tried your schema above and an XML instance I made up with both 
MSXML 4 and with the Xerces Java parser used by the jEdit editor and its 
XML plugin and both handled the schema without problems and depending on 
the content of the sole element flagged a validation error if the 
minInlusive constraint was not fulfilled.
Thus I don't think there is anything wrong with the schema.

What is msv, is that simply a validator? Perhaps the exception happens 
because of some other problems unrelated to the validation features 
Xerces provides.

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.