Hi,

While testing XQilla with Xerces-C 2.8.0 I was getting XML parse exceptions trying to run the basic examples. Looking into the code I noticed that XQilla by default passes an empty string (where val != NULL && XMLString::stringLen(val) == 0) to XMLScanner::setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation. This seems to trick the scanner into thinking there is an external schema to parse. SGMLScanner::resolveSchemaGrammar then throws a parse exception because it tries to parse a URL constructed by concatenating the current working directory with the empty string.

Is this an XQilla or Xerces problem? Should Xerces ignore 0-length strings here?

Modifying XMLScanner::setExternalSchemaLocation to ignore 0-length strings seems to fix the problem (same issue with setExternalNoNamespaceSchemaLocation):

----

inline void XMLScanner::setExternalSchemaLocation(const XMLCh* const schemaLocation)
{
   if (fExternalSchemaLocation) {
       fMemoryManager->deallocate(fExternalSchemaLocation);
       fExternalSchemaLocation = NULL;
   }

   // Only set if we're passed a non-trivial string
   if (schemaLocation && XMLString::stringLen (schemaLocation))
fExternalSchemaLocation = XMLString::replicate(schemaLocation, fMemoryManager);
}

Thanks,
Jerry







Reply via email to