You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2006/03/17 22:29:32 UTC
svn commit: r386722 - in
/xerces/c/branches/xerces-2.7/src/xercesc/framework: XMLValidator.cpp
XMLValidator.hpp
Author: cargilld
Date: Fri Mar 17 13:29:31 2006
New Revision: 386722
URL: http://svn.apache.org/viewcvs?rev=386722&view=rev
Log:
Display actual errorCode when reporting an error.
Modified:
xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp
xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.hpp
Modified: xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp?rev=386722&r1=386721&r2=386722&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp Fri Mar 17 13:29:31 2006
@@ -270,6 +270,64 @@
}
}
+void XMLValidator::emitError(const XMLValid::Codes toEmit
+ , const XMLExcepts::Codes originalExceptCode
+ , const XMLCh* const text1
+ , const XMLCh* const text2
+ , const XMLCh* const text3
+ , const XMLCh* const text4)
+{
+ // Bump the error count if it is not a warning
+ if (XMLValid::errorType(toEmit) != XMLErrorReporter::ErrType_Warning)
+ fScanner->incrementErrorCount();
+
+ // Call error reporter if we have one
+ if (fErrorReporter)
+ {
+ //
+ // Load the message into alocal and replace any tokens found in
+ // the text.
+ //
+ const unsigned int maxChars = 2047;
+ XMLCh errText[maxChars + 1];
+
+ // load the text
+ if (!getMsgLoader().loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, fScanner->getMemoryManager()))
+ {
+ // <TBD> Should probably load a default message here
+ }
+
+ //
+ // Create a LastExtEntityInfo structure and get the reader manager
+ // to fill it in for us. This will give us the information about
+ // the last reader on the stack that was an external entity of some
+ // sort (i.e. it will ignore internal entities.
+ //
+ ReaderMgr::LastExtEntityInfo lastInfo;
+ fReaderMgr->getLastExtEntityInfo(lastInfo);
+
+ fErrorReporter->error
+ (
+ originalExceptCode
+ , XMLUni::fgExceptDomain //XMLUni::fgValidityDomain
+ , XMLValid::errorType(toEmit)
+ , errText
+ , lastInfo.systemId
+ , lastInfo.publicId
+ , lastInfo.lineNumber
+ , lastInfo.colNumber
+ );
+ }
+
+ // Bail out if its fatal an we are to give up on the first fatal error
+ if (((XMLValid::isError(toEmit) && fScanner->getValidationConstraintFatal())
+ || XMLValid::isFatal(toEmit))
+ && fScanner->getExitOnFirstFatal()
+ && !fScanner->getInException())
+ {
+ throw toEmit;
+ }
+}
// ---------------------------------------------------------------------------
// XMLValidator: Hidden Constructors
Modified: xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.hpp?rev=386722&r1=386721&r2=386722&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.hpp Fri Mar 17 13:29:31 2006
@@ -304,6 +304,16 @@
, const char* const text2 = 0
, const char* const text3 = 0
, const char* const text4 = 0
+ );
+ void emitError
+ (
+ const XMLValid::Codes toEmit
+ , const XMLExcepts::Codes originalErrorCode
+ , const XMLCh* const text1 = 0
+ , const XMLCh* const text2 = 0
+ , const XMLCh* const text3 = 0
+ , const XMLCh* const text4 = 0
+
);
//@}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org