It seems to me that the SGXMLScanner is at fault here, since XQilla works fine with the IGXMLScanner.

The problem seems to be caused because the IGXMLScanner uses a method called processSchemaLocation() to parse the schema location string, where as the SGXMLScanner uses XMLString::tokenizeString().

John

J Napoli wrote:
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

--
John Snelson, Oracle Corporation            http://snelson.org.uk/john
Berkeley DB XML:        http://www.oracle.com/database/berkeley-db/xml
XQilla:                                  http://xqilla.sourceforge.net

Reply via email to