I’m having some problems validating XML files against
the COLLADASchema.xsd XML schema file using
I can manage to successfully test validation works using some
of the examples that come with Xerces ( e.g by adding illegal
elements into the file ) but if I try the same with collada it does’nt complain about bad elements.
I’ve had the same results with the W3C XML Schema validator.
I think there is something wrong in the way the XSD is either declared
or defined but I’m not sure what.
Is the validation taking a really long time?
When we were testing libxml vs xerces we noticed that the xerces validation would take an incredibly long time.
If yours isn’t taking long then maybe you have the xerces settings incorrect.
The step we had to take to make xerces validate are
XercesDOMParser* parser = new XercesDOMParser();
parser->setExternalSchemaLocation( schema );
parser->setDoValidation( true );
errorHandler* errHandler = new errorHandler();
where schema defaulted to “http://www.collada.org/2005/COLLADASchema COLLADASchema.xsd”.
Now I know this was for validating against 1.3.1. I believe we also did some tests on early 1.4 beta schemas but a lot has changed since then.
… the ‘validation’ is really quick, indicating that no validation can be
These are the calls I’m making when setting up my parser
as you suggested
m_pParser = new SAXParser;
which still does’nt work. I’ve also tried it using the XMLDOMParser instead of the SAXParser.
I’m also using progressive parsing ( does that work w. validation?) as I find it easier for my needs to writing an import algorithm.
I noticed you are using libxml with the COLLADA viewer code. What made you choose libxml over other XML libs. Does it support progressive parsing?
The difference I see is the setExternalSchemaLocation().
From my knowlege that function needs a string with two things in it.
- The schema namespace “http://www.collada.org/2005/COLLADASchema”
- The location of the schema “COLLADASchema.xsd” - I had the schema file in my working directory.
Also, the schema you are providing is the 1.3 namespace. If you are trying to validate 1.4 documents that might be a problem.
remember the 1.4 schema is “http://www.collada.org/2005/11/COLLADASchema”
We chose the libxml2 plugin for the DOM because of validation speed. We tested the two parsers and just found that libxml was considerably faster with full validation turned on. Xerces might have improved since then but I don’t know. I haven’t looked at it in quite a few months.