diff --git a/src/xercesc/dom/DOMError.hpp b/src/xercesc/dom/DOMError.hpp index 53d7db3695bad8bdbac5cfca7329babd0c474a6c..fb4ad20f29254799583794e65ced63e05174e91f 100644 --- a/src/xercesc/dom/DOMError.hpp +++ b/src/xercesc/dom/DOMError.hpp @@ -59,6 +59,9 @@ /* * $Log$ + * Revision 1.9 2003/05/14 18:06:53 gareth + * Updated DOMError to http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/core.html. + * * Revision 1.8 2003/03/07 19:59:04 tng * [Bug 11692] Unimplement the hidden constructors and assignment operator to remove warnings from gcc. * @@ -201,6 +204,36 @@ public: */ virtual void* getRelatedException() const = 0; + /** + * A <code>XMLCh*</code> indicating which related data is expected in + * relatedData. Users should refer to the specification of the error + * in order to find its <code>XMLCh*</code> type and relatedData + * definitions if any. + * + * Note: As an example, [DOM Level 3 Load and Save] does not keep the + * [baseURI] property defined on a Processing Instruction information item. + * Therefore, the DOMBuilder generates a SEVERITY_WARNING with type + * "infoset-baseURI" and the lost [baseURI] property represented as a + * DOMString in the relatedData attribute. + * + * <p><b>"Experimental - subject to change"</b></p> + * + * @see setType + * @since DOM Level 3 + */ + virtual const XMLCh* getType() const = 0; + + /** + * The related DOMError.type dependent data if any. + * + * <p><b>"Experimental - subject to change"</b></p> + * + * @see setRelatedData + * @since DOM Level 3 + */ + virtual void* getRelatedData() const = 0; + + // ----------------------------------------------------------------------- // Setter methods // ----------------------------------------------------------------------- @@ -248,6 +281,35 @@ public: */ virtual void setRelatedException(void* exception) const = 0; + /** + * A <code>XMLCh*</code> indicating which related data is expected in + * relatedData. Users should refer to the specification of the error + * in order to find its <code>XMLCh*</code> type and relatedData + * definitions if any. + * + * Note: As an example, [DOM Level 3 Load and Save] does not keep the + * [baseURI] property defined on a Processing Instruction information item. + * Therefore, the DOMBuilder generates a SEVERITY_WARNING with type + * "infoset-baseURI" and the lost [baseURI] property represented as a + * DOMString in the relatedData attribute. + * + * <p><b>"Experimental - subject to change"</b></p> + * + * @see getType + * @since DOM Level 3 + */ + virtual void setType(const XMLCh* type) = 0; + + /** + * The related DOMError.type dependent data if any. + * + * <p><b>"Experimental - subject to change"</b></p> + * + * @see getRelatedData + * @since DOM Level 3 + */ + virtual void setRelatedData(void* relatedData) = 0; + //@} }; diff --git a/src/xercesc/dom/impl/DOMErrorImpl.cpp b/src/xercesc/dom/impl/DOMErrorImpl.cpp index 7b10d0c6f3728fd8c121ba5a99bb717a6096a4ae..6ab99d95f2d2df75e86e2fd840aae0bf3e462037 100644 --- a/src/xercesc/dom/impl/DOMErrorImpl.cpp +++ b/src/xercesc/dom/impl/DOMErrorImpl.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/05/14 18:06:53 gareth + * Updated DOMError to http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/core.html. + * * Revision 1.4 2002/11/04 15:07:34 tng * C++ Namespace Support. * @@ -85,6 +88,9 @@ fAdoptLocation(false) , fSeverity(severity) , fMessage(0) , fLocation(0) +, fType(0) +, fRelatedData(0) +, fAdoptRelatedData(false) { } @@ -95,13 +101,34 @@ fAdoptLocation(false) , fSeverity(severity) , fMessage(message) , fLocation(location) +, fType(0) +, fRelatedData(0) +, fAdoptRelatedData(false) +{ +} + +DOMErrorImpl::DOMErrorImpl(const short severity, + const XMLCh* type, + const XMLCh* message, + void* relatedData, + bool adoptRelatedData) : +fAdoptLocation(false) +, fSeverity(severity) +, fMessage(message) +, fLocation(0) +, fType(type) +, fRelatedData(relatedData) +, fAdoptRelatedData(adoptRelatedData) { + } DOMErrorImpl::~DOMErrorImpl() { if (fAdoptLocation) delete fLocation; + if(fAdoptRelatedData) + delete fRelatedData; } // --------------------------------------------------------------------------- diff --git a/src/xercesc/dom/impl/DOMErrorImpl.hpp b/src/xercesc/dom/impl/DOMErrorImpl.hpp index 68016d16b22642ad93ac7c585f100cf920aaf527..7111a1be2443914db8aa6e28ea8d48124f466a1e 100644 --- a/src/xercesc/dom/impl/DOMErrorImpl.hpp +++ b/src/xercesc/dom/impl/DOMErrorImpl.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.6 2003/05/14 18:06:53 gareth + * Updated DOMError to http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/core.html. + * * Revision 1.5 2003/03/07 18:07:17 tng * Return a reference instead of void for operator= * @@ -78,7 +81,8 @@ #define DOMERRORIMPL_HPP #include <xercesc/dom/DOMError.hpp> - +#include <iostream.h> +#include <xercesc/util/XMLString.hpp> XERCES_CPP_NAMESPACE_BEGIN @@ -105,6 +109,15 @@ public: , DOMLocator* const location ); + DOMErrorImpl + ( + const short severity + , const XMLCh* type + , const XMLCh* message + , void* relatedData + , bool adoptRelatedData = false + ); + /** Desctructor */ virtual ~DOMErrorImpl(); @@ -144,6 +157,10 @@ public: */ virtual void* getRelatedException() const; + virtual const XMLCh* getType() const; + + virtual void* getRelatedData() const; + //@} @@ -178,10 +195,6 @@ public: virtual void setLocation(DOMLocator* const location); /** - * <p><b>"Experimental - subject to change"</b></p> - * - * Set whether the location is owned by DOMError or not - * * @param value <code>true</code> if DOMLocator is owned and should be * deleted, <code>false</code> otherwise. */ @@ -198,6 +211,15 @@ public: */ virtual void setRelatedException(void* exception) const; + virtual void setType(const XMLCh* type); + + virtual void setRelatedData(void* relatedData); + + /** + * @param value <code>true</code> if RelatedData is owned and should be + * deleted, <code>false</code> otherwise. + */ + void setAdoptRelatedData(bool adoptRelatedData); //@} @@ -220,15 +242,27 @@ private : // The type of the error. // // fMessage - // The error message + // The error message. // // fLocation - // The location info of the error + // The location info of the error. + // + // fType + // The type of the error. + // + // fRelatedData + // The data related to this error. + // + // fAdoptRelatedData + // Indicates whether we own the fRelatedData object or not. // ----------------------------------------------------------------------- bool fAdoptLocation; short fSeverity; const XMLCh* fMessage; DOMLocator* fLocation; + const XMLCh* fType; + void* fRelatedData; + bool fAdoptRelatedData; }; // --------------------------------------------------------------------------- @@ -254,6 +288,16 @@ inline void* DOMErrorImpl::getRelatedException() const return 0; } +inline const XMLCh* DOMErrorImpl::getType() const +{ + return fType; +} + +inline void* DOMErrorImpl::getRelatedData() const +{ + return fRelatedData; +} + // --------------------------------------------------------------------------- // DOMLocatorImpl: Setter methods // --------------------------------------------------------------------------- @@ -272,6 +316,19 @@ inline void DOMErrorImpl::setAdoptLocation(const bool value) fAdoptLocation = value; } +inline void DOMErrorImpl::setType(const XMLCh* type) +{ + fType = type; +} + +inline void DOMErrorImpl::setRelatedData(void* relatedData) +{ + fRelatedData = relatedData; +} + +inline void DOMErrorImpl::setAdoptRelatedData(bool adoptRelatedData) { + fAdoptRelatedData = adoptRelatedData; +} XERCES_CPP_NAMESPACE_END