Author: dbertoni
Date: Mon Jan 30 15:12:45 2006
New Revision: 373626
URL: http://svn.apache.org/viewcvs?rev=373626&view=rev
Log:
Fixed problems with report exception-based errors.
Modified:
xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp
xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp
xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.cpp
xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.hpp
Modified: xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp
URL:
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp?rev=373626&r1=373625&r2=373626&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp
(original)
+++ xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp Mon
Jan 30 15:12:45 2006
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/*
- * $Id $
- */
-
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
@@ -432,7 +428,7 @@
dv->validate(attValue, fValidationContext, fMemoryManager);
}
catch(const XMLException& excep) {
- schema->reportSchemaError(elem, XMLUni::fgXMLErrDomain,
XMLErrs::DisplayErrorMessage, excep.getMessage());
+ schema->reportSchemaError(elem, excep);
}
catch(const OutOfMemoryException&)
{
Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
URL:
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp?rev=373626&r1=373625&r2=373626&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp Mon Jan 30
15:12:45 2006
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/*
- * $Id $
- */
-
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
@@ -909,7 +905,7 @@
baseGroup->getContentSpec(),
baseGroup->getScope());
}
catch (const XMLException& excep) {
-
fSchemaErrorReporter.emitError(XMLErrs::DisplayErrorMessage,
XMLUni::fgXMLErrDomain, curGroup.getLocator(), excep.getMessage(), 0, 0, 0,
fMemoryManager);
+ fSchemaErrorReporter.emitError(excep,
curGroup.getLocator());
}
}
@@ -1093,7 +1089,7 @@
baseTypeInfo->getScopeDefined(),
baseTypeInfo);
}
catch (const XMLException& excep) {
- fSchemaErrorReporter.emitError(XMLErrs::DisplayErrorMessage,
XMLUni::fgXMLErrDomain, curTypeInfo->getLocator(), excep.getMessage(), 0, 0, 0,
fMemoryManager);
+ fSchemaErrorReporter.emitError(excep, curTypeInfo->getLocator());
}
}
}
Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL:
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?rev=373626&r1=373625&r2=373626&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Mon Jan 30
15:12:45 2006
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/*
- * $Id$
- */
-
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
@@ -1986,7 +1982,7 @@
, fMemoryManager);
}
catch(const XMLException& excep) {
- reportSchemaError(elem, XMLUni::fgXMLErrDomain,
XMLErrs::DisplayErrorMessage, excep.getMessage());
+ reportSchemaError(elem, excep);
}
uriIndex = fURIStringPool->addOrFind(tokenElem);
}
@@ -2429,7 +2425,7 @@
, fMemoryManager);
}
catch (const XMLException& excep) {
- reportSchemaError(elem, XMLUni::fgValidityDomain,
XMLValid::DisplayErrorMessage, excep.getMessage());
+ reportSchemaError(elem, excep);
}
catch(const OutOfMemoryException&)
{
@@ -3007,7 +3003,7 @@
qualifiedName, baseValidator, 0, 0, true, finalSet, true,
fGrammarPoolMemoryManager);
}
catch (const XMLException& excep) {
- reportSchemaError(contentElem, XMLUni::fgValidityDomain,
XMLValid::DisplayErrorMessage, excep.getMessage());
+ reportSchemaError(contentElem, excep);
}
catch(const OutOfMemoryException&)
{
@@ -3277,7 +3273,7 @@
newDV = fDatatypeRegistry->createDatatypeValidator(qualifiedName,
baseValidator, janFacets.release(), enums.release(), false, finalSet, true,
fGrammarPoolMemoryManager);
}
catch (const XMLException& excep) {
- reportSchemaError(contentElem, XMLUni::fgValidityDomain,
XMLValid::DisplayErrorMessage, excep.getMessage());
+ reportSchemaError(contentElem, excep);
}
catch(const OutOfMemoryException&)
{
@@ -3411,7 +3407,7 @@
newDV = fDatatypeRegistry->createDatatypeValidator(qualifiedName,
validators, finalSet, true, fGrammarPoolMemoryManager);
}
catch (const XMLException& excep) {
- reportSchemaError(contentElem, XMLUni::fgValidityDomain,
XMLValid::DisplayErrorMessage, excep.getMessage());
+ reportSchemaError(contentElem, excep);
}
catch(const OutOfMemoryException&)
{
@@ -3783,7 +3779,7 @@
typeInfo->setDatatypeValidator(simpleDV);
}
catch (const XMLException& excep) {
- reportSchemaError(simpleContent, XMLUni::fgValidityDomain,
XMLValid::DisplayErrorMessage, excep.getMessage());
+ reportSchemaError(simpleContent, excep);
}
catch(const OutOfMemoryException&)
{
@@ -4092,7 +4088,7 @@
, fMemoryManager);
}
catch(const XMLException& excep) {
- reportSchemaError(elem, XMLUni::fgXMLErrDomain,
XMLErrs::DisplayErrorMessage, excep.getMessage());
+ reportSchemaError(elem, excep);
}
uriIndex = fURIStringPool->addOrFind(token);
}
@@ -4426,7 +4422,7 @@
}
catch (const XPathException& e) {
- reportSchemaError(elem, XMLUni::fgXMLErrDomain,
XMLErrs::DisplayErrorMessage, e.getMessage());
+ reportSchemaError(elem, e);
return false;
}
@@ -4499,7 +4495,7 @@
}
catch (const XPathException& e) {
- reportSchemaError(elem, XMLUni::fgXMLErrDomain,
XMLErrs::DisplayErrorMessage, e.getMessage());
+ reportSchemaError(elem, e);
return false;
}
}
@@ -5855,7 +5851,7 @@
, fMemoryManager);
}
catch(const XMLException& excep) {
- reportSchemaError(elem, XMLUni::fgValidityDomain,
XMLValid::DisplayErrorMessage, excep.getMessage());
+ reportSchemaError(elem, excep);
}
catch(const OutOfMemoryException&)
{
@@ -8468,6 +8464,16 @@
fXSDErrorReporter.emitError(errorCode, msgDomain, fLocator, text1, text2,
text3, text4, fMemoryManager);
}
+void TraverseSchema::reportSchemaError(const DOMElement* const elem,
+ const XMLException& except)
+{
+ fLocator->setValues(fSchemaInfo->getCurrentSchemaURL(), 0,
+ ((XSDElementNSImpl*) elem)->getLineNo(),
+ ((XSDElementNSImpl*) elem)->getColumnNo());
+
+ fXSDErrorReporter.emitError(except, fLocator);
+}
+
// ---------------------------------------------------------------------------
// TraverseSchema: Init/CleanUp methods
// ---------------------------------------------------------------------------
@@ -8663,7 +8669,7 @@
}
catch(const XMLException& excep)
{
- reportSchemaError(elem, XMLUni::fgValidityDomain,
XMLValid::DisplayErrorMessage, excep.getMessage());
+ reportSchemaError(elem, excep);
}
catch(const OutOfMemoryException&)
{
Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp
URL:
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp?rev=373626&r1=373625&r2=373626&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp Mon Jan 30
15:12:45 2006
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/*
- * $Id$
- */
-
#if !defined(TRAVERSESCHEMA_HPP)
#define TRAVERSESCHEMA_HPP
@@ -227,6 +223,8 @@
const XMLCh* const text2 = 0,
const XMLCh* const text3 = 0,
const XMLCh* const text4 = 0);
+ void reportSchemaError(const DOMElement* const elem,
+ const XMLException& except);
// -----------------------------------------------------------------------
// Private Helper methods
Modified: xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.cpp
URL:
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.cpp?rev=373626&r1=373625&r2=373626&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.cpp Mon Jan
30 15:12:45 2006
@@ -14,11 +14,6 @@
* limitations under the License.
*/
-/*
- * $Id$
- */
-
-
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
@@ -222,6 +217,23 @@
if (fErrorReporter)
fErrorReporter->error(toEmit, msgDomain, errType, errText,
aLocator->getSystemId(),
+ aLocator->getPublicId(),
aLocator->getLineNumber(),
+ aLocator->getColumnNumber());
+
+ // Bail out if its fatal an we are to give up on the first fatal error
+ if (errType == XMLErrorReporter::ErrType_Fatal && fExitOnFirstFatal)
+ throw (XMLErrs::Codes) toEmit;
+}
+
+void XSDErrorReporter::emitError(const XMLException& except,
+ const Locator* const aLocator)
+{
+ const XMLCh* const errText = except.getMessage();
+ const unsigned int toEmit = except.getCode();
+ XMLErrorReporter::ErrTypes errType = XMLErrs::errorType((XMLErrs::Codes)
toEmit);
+
+ if (fErrorReporter)
+ fErrorReporter->error(toEmit, XMLUni::fgExceptDomain, errType,
errText, aLocator->getSystemId(),
aLocator->getPublicId(),
aLocator->getLineNumber(),
aLocator->getColumnNumber());
Modified: xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.hpp
URL:
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.hpp?rev=373626&r1=373625&r2=373626&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/XSDErrorReporter.hpp Mon Jan
30 15:12:45 2006
@@ -14,11 +14,6 @@
* limitations under the License.
*/
- /*
- * $Id$
- */
-
-
#if !defined(XSDERRORREPORTER_HPP)
#define XSDERRORREPORTER_HPP
@@ -71,6 +66,8 @@
const XMLCh* const text4 = 0,
MemoryManager* const manager =
XMLPlatformUtils::fgMemoryManager
);
+ void emitError(const XMLException& except,
+ const Locator* const aLocator);
private:
// -----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]