I’m getting an exception in the parse method when my Root element start tag contains a CR/LF. When the CR/LF is removed, the error goes away. I’ve read through the standard and I’m not clear as to whether the CR/LF is permitted or not. I do know that XMLSpy validates the file with the CR/LF included. Is this the intended behavior for the library or is this a bug? I’m using Xerces C++ v2.7.0 on a Windows XP platform. I build the library with Visual Studio 2003.
My XML file starts with the lines listed below (notice the CR/LF before the schema filename). An exception is thrown on the parse call. <?xml version="1.0" encoding="UTF-8"?> <MyRootTag Name="Steve1" Version="1.0" Description="A test" xmlns=http://www.ourwebsite.com/myNamespace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation=" http://www.ourwebsite.com/myNamespace myApps_Schema.xsd"> Here is the code snippet that processes the XML containing the above lines: DOMcreationErrorHandler* myErrorHandler = new DOMcreationErrorHandler; try { MemBufInputSource m( (const XMLByte*)receivedXML.c_str(),receivedXML.size(), "myXMLString"); XercesDOMParser myParser; std::string const schemaLocation = "http://www.ourwebsite.com/myNamespace myApps_Schema.xsd"; myParser.setDoNamespaces(true); myParser.setDoSchema(true); myParser.setExternalSchemaLocation(schemaLocation.c_str() ); myParser.setValidationSchemaFullChecking(true); myParser.setValidationConstraintFatal(true); myParser.setErrorHandler( (ErrorHandler*) myErrorHandler); myParser.parse(m); The parse call triggers an exception caught by the last of these four catch blocks: catch (std::exception &ex) { // Code removed. A message is logged. } catch (OutOfMemoryException const &/*ex*/) { // Code removed. A message is logged. } catch (DOMException const &e) { // Code removed. A message is logged. } catch (...) { // Code removed. A message is logged. } Thanks in advance for your help, Steve
