validation of collada file against XSD w. Xerces-C

I’m having some problems validating XML files against
the COLLADASchema.xsd XML schema file using
Xerces.

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.

Mark

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->setValidationScheme(XercesDOMParser::Val_Always);
	parser->setDoNamespaces(true);
	parser->setDoSchema(true);
	parser->setExternalSchemaLocation( schema );
	parser->setDoValidation( true );
	parser->setValidationSchemaFullChecking(true);
	
	errorHandler* errHandler = new errorHandler();
	parser->setErrorHandler((ErrorHandler*)errHandler);
	try {
		parser->parse(inFile);
	}

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.

-Andy

… the ‘validation’ is really quick, indicating that no validation can be
taking place.

These are the calls I’m making when setting up my parser
as you suggested


m_pParser = new SAXParser;

m_pParser->setValidationScheme(SAXParser::Val_Always);
m_pParser->setDoNamespaces(true);
m_pParser->setDoSchema(true);
m_pParser->setExternalSchemaLocation("http://www.collada.org/2005/COLLADASchema.xsd");
m_pParser->setValidationSchemaFullChecking(true);
m_pParser->setDocumentHandler(this);
m_pParser->setErrorHandler(this);


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?

mark

The difference I see is the setExternalSchemaLocation().
From my knowlege that function needs a string with two things in it.

  1. The schema namespace “http://www.collada.org/2005/COLLADASchema
  2. 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 “COLLADA 1.4 Schema

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.

-Andy