diff --git a/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp b/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp index 06d88141214c2eb9c87c54a40f5add1cb31c5e58..bf62feed3551ffada19f23f444083ea9409281db 100644 --- a/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp +++ b/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp @@ -2055,6 +2055,14 @@ SOURCE=..\..\..\..\..\src\xercesc\dom\impl\DOMEntityReferenceImpl.hpp # End Source File # Begin Source File +SOURCE=..\..\..\..\..\src\xercesc\dom\impl\DOMErrorImpl.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\..\src\xercesc\dom\impl\DOMErrorImpl.hpp +# End Source File +# Begin Source File + SOURCE=..\..\..\..\..\src\xercesc\dom\impl\DOMImplementationImpl.cpp # End Source File # Begin Source File @@ -2063,6 +2071,14 @@ SOURCE=..\..\..\..\..\src\xercesc\dom\impl\DOMImplementationimpl.hpp # End Source File # Begin Source File +SOURCE=..\..\..\..\..\src\xercesc\dom\impl\DOMLocatorImpl.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\..\src\xercesc\dom\impl\DOMLocatorImpl.hpp +# End Source File +# Begin Source File + SOURCE=..\..\..\..\..\src\xercesc\dom\impl\DOMNamedNodeMapImpl.cpp # End Source File # Begin Source File @@ -2700,6 +2716,14 @@ SOURCE=..\..\..\..\..\src\xercesc\dom\DOMEntityReference.hpp # End Source File # Begin Source File +SOURCE=..\..\..\..\..\src\xercesc\dom\DOMError.hpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\..\src\xercesc\dom\DOMErrorHandler.hpp +# End Source File +# Begin Source File + SOURCE=..\..\..\..\..\src\xercesc\dom\DOMException.cpp # End Source File # Begin Source File @@ -2712,6 +2736,10 @@ SOURCE=..\..\..\..\..\src\xercesc\dom\DOMImplementation.hpp # End Source File # Begin Source File +SOURCE=..\..\..\..\..\src\xercesc\dom\DOMLocator.hpp +# End Source File +# Begin Source File + SOURCE=..\..\..\..\..\src\xercesc\dom\DOMNamedNodeMap.hpp # End Source File # Begin Source File diff --git a/src/xercesc/dom/DOMError.hpp b/src/xercesc/dom/DOMError.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ec383c9174adb9b108c698b0730af917a36506c8 --- /dev/null +++ b/src/xercesc/dom/DOMError.hpp @@ -0,0 +1,172 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache\@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation, and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com . For more information + * on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +/* + * $Log$ + * Revision 1.1 2002/05/23 15:47:24 knoaman + * DOM L3 core - support for DOMError, DOMErrorHandler and DOMLocator + * + */ + + +#ifndef DOMERROR_HPP +#define DOMERROR_HPP + +#include <xercesc/util/XercesDefs.hpp> + +class DOMLocator; + + +/** + * DOMError is an interface that describes an error. + * + * @see DOMErrorHandler#handleError + */ + +class CDOM_EXPORT DOMError +{ +protected: + /** @name Constructors */ + //@{ + + /** Default constructor */ + DOMError() {}; + + //@} + +public: + + // ----------------------------------------------------------------------- + // Class types + // ----------------------------------------------------------------------- + enum ErrorSeverity + { + SEVERITY_WARNING = 0, + SEVERITY_ERROR = 1, + SEVERITY_FATAL_ERROR = 2 + }; + + + /** @name Destructor */ + //@{ + + /** Desctructor */ + virtual ~DOMError() + { + } + + //@} + + /** @name Get function */ + //@{ + + /** + * Get the severity of the error + */ + virtual short getSeverity() const = 0; + + /** + * Get the message describing the error that occured. + */ + virtual const XMLCh* getMessage() const = 0; + + /** + * Get the location of the error + */ + virtual DOMLocator* getLocation() const = 0; + + //@} + + + /** @name Set function */ + //@{ + + /** + * Set the severity of the error + * + * @param severity the type of the error to set + */ + virtual void setSeverity(const short severity) = 0; + + /** + * Set the error message + * + * @param message the error message to set. + */ + virtual void setMessage(const XMLCh* const message) = 0; + + /** + * Set the location of the error + * + * @param location the location of the error to set. + */ + virtual void setLocation(DOMLocator* const location) = 0; + + //@} + + +private : + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + DOMError(const DOMError&); + + /* Assignment operator */ + void operator=(const DOMError&); + +}; + +#endif diff --git a/src/xercesc/dom/DOMErrorHandler.hpp b/src/xercesc/dom/DOMErrorHandler.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ae1b76d47593f30c2b89a828ba362b839ae3bebc --- /dev/null +++ b/src/xercesc/dom/DOMErrorHandler.hpp @@ -0,0 +1,146 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache\@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation, and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com . For more information + * on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +/* + * $Log$ + * Revision 1.1 2002/05/23 15:47:24 knoaman + * DOM L3 core - support for DOMError, DOMErrorHandler and DOMLocator + * + */ + + +#ifndef DOMERRORHANDLER_HPP +#define DOMERRORHANDLER_HPP + +#include <xercesc/util/XercesDefs.hpp> + +class DOMError; + + +/** + * Basic interface for DOM error handlers. + * + * <p>DOMErrorHandler is a callback interface that the DOM implementation + * can call when reporting errors that happens while processing XML data, or + * when doing some other processing (e.g. validating a document).</p> + * + * <p>The application that is using the DOM implementation is expected to + * implement this interface.</p> + * + * @see DOMBuilder#setErrorHandler + */ + +class CDOM_EXPORT DOMErrorHandler +{ +protected: + /** @name Constructors */ + //@{ + + /** Default constructor */ + DOMErrorHandler() {}; + + //@} + +public: + /** @name Destructor */ + //@{ + + /** Desctructor */ + virtual ~DOMErrorHandler() + { + } + + //@} + + /** @name The error handler interface */ + //@{ + /** + * This method is called on the error handler when an error occures. + * + * @param domError The error object that describes the error, this object + * may be reused by the DOM implementation across multiple + * calls to the handleEvent method. + * @return If the handleError method returns <code>true</code> the DOM + * implementation should continue as if the error didn't happen + * when possible, if the method returns <code>false</code> then the + * DOM implementation should stop the current processing when + * possible. + */ + virtual bool handleError(const DOMError& domError) = 0; + + /** + * Reset the Error handler object on its reuse + * + * <p>This method helps in reseting the Error handler object + * implementational defaults each time the Error handler is begun.</p> + * + */ + virtual void resetErrors() = 0; + + //@} + +private : + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + DOMErrorHandler(const DOMErrorHandler&); + + /* Assignment operator */ + void operator=(const DOMErrorHandler&); + +}; + +#endif diff --git a/src/xercesc/dom/DOMLocator.hpp b/src/xercesc/dom/DOMLocator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f11c7be698c11f19b49532001519f3810e2700fe --- /dev/null +++ b/src/xercesc/dom/DOMLocator.hpp @@ -0,0 +1,211 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache\@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation, and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com . For more information + * on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +/* + * $Log$ + * Revision 1.1 2002/05/23 15:47:24 knoaman + * DOM L3 core - support for DOMError, DOMErrorHandler and DOMLocator + * + */ + + +#ifndef DOMLOCATOR_HPP +#define DOMLOCATOR_HPP + +#include <xercesc/util/XercesDefs.hpp> + +class DOMNode; + + +/** + * DOMLocator is an interface that describes a location (e.g. where an error + * occured). + * + * @see DOMError#DOMError + */ + +class CDOM_EXPORT DOMLocator +{ +protected: + /** @name Constructors */ + //@{ + + /** Default constructor */ + DOMLocator() {}; + + //@} + +public: + /** @name Destructor */ + //@{ + + /** Desctructor */ + virtual ~DOMLocator() + { + } + + //@} + + /** @name Get function */ + //@{ + + /** + * Get the line number where the error occured. The value is -1 if there is + * no line number available. + * + * @see #setLineNumber + */ + virtual long getLineNumber() const = 0; + + /** + * Get the column number where the error occured. The value is -1 if there + * is no column number available. + * + * @see #setColumnNumber + */ + virtual long getColumnNumber() const = 0; + + /** + * Get the byte or character offset into the input source, if we're parsing + * a file or a byte stream then this will be the byte offset into that + * stream, but if a character media is parsed then the offset will be the + * character offset. The value is -1 if there is no offset available. + * + * @see #setOffset + */ + virtual long getOffset() const = 0; + + /** + * Get the DOM Node where the error occured, or <code>null</code> if there + * is no node available. + * + * @see #setErrorNode + */ + virtual DOMNode* getErrorNode() const = 0; + + /** + * Get the URI where the error occured, or <code>null</code> if there is no + * URI available. + * + * @see #setURI + */ + virtual const XMLCh* getURI() const = 0; + + //@} + + + /** @name Set function */ + //@{ + + /** + * Set the line number of the error + * + * @param lineNumber the line number to set + * + * @see #getLinNumner + */ + virtual void setLineNumber(const long lineNumber) = 0; + + /** + * Set the column number of the error + * + * @param columnNumber the column number to set. + * + * @see #getColumnNumner + */ + virtual void setColumnNumber(const long columnNumber) = 0; + + /** + * Set the byte/character offset. + * + * @param offset the byte/characte offset to set. + * + * @see #getOffset + */ + virtual void setOffset(const long offset) = 0; + + /** + * Set the DOM Node where the error occured + * + * @param errorNode the DOM Node to set + * + * @see #getErrorNode + */ + virtual void setErrorNode(DOMNode* const errorNode) = 0; + + /** + * Set the URI where the error occured + * + * @param uri the URI to set. + * + * @see #getURI + */ + virtual void setURI(const XMLCh* const uri) = 0; + + //@} + + +private : + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + DOMLocator(const DOMLocator&); + + /* Assignment operator */ + void operator=(const DOMLocator&); +}; + +#endif diff --git a/src/xercesc/dom/Makefile.in b/src/xercesc/dom/Makefile.in index a190985df801bd991b7ec7df84c711cadb5c08b4..fdb4de4da874c3ee90fad83de1d9a29126c832ad 100644 --- a/src/xercesc/dom/Makefile.in +++ b/src/xercesc/dom/Makefile.in @@ -88,8 +88,11 @@ DOM_CPP_PUBHEADERS = \ DOMElement.hpp \ DOMEntity.hpp \ DOMEntityReference.hpp \ + DOMError.hpp \ + DOMErrorHandler.hpp \ DOMException.hpp \ DOMImplementation.hpp \ + DOMLocator.hpp \ DOMNamedNodeMap.hpp \ DOMNode.hpp \ DOMNodeFilter.hpp \ diff --git a/src/xercesc/dom/impl/DOMErrorImpl.cpp b/src/xercesc/dom/impl/DOMErrorImpl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8871b69a7a0427f56f18906d5cd2689cb20c9666 --- /dev/null +++ b/src/xercesc/dom/impl/DOMErrorImpl.cpp @@ -0,0 +1,103 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache\@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation, and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com . For more information + * on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +/* + * $Log$ + * Revision 1.1 2002/05/23 15:47:24 knoaman + * DOM L3 core - support for DOMError, DOMErrorHandler and DOMLocator + * + */ + +#include <xercesc/dom/impl/DOMErrorImpl.hpp> +#include <xercesc/dom/DOMLocator.hpp> + +// --------------------------------------------------------------------------- +// DOMErrorImpl: Constructors and Destructor +// --------------------------------------------------------------------------- +DOMErrorImpl::DOMErrorImpl(const short severity) : +fAdoptLocation(false) +, fSeverity(severity) +, fMessage(0) +, fLocation(0) +{ +} + +DOMErrorImpl::DOMErrorImpl(const short severity, + const XMLCh* const message, + DOMLocator* const location) : +fAdoptLocation(false) +, fSeverity(severity) +, fMessage(message) +, fLocation(location) +{ +} + +DOMErrorImpl::~DOMErrorImpl() +{ + if (fAdoptLocation) + delete fLocation; +} + +// --------------------------------------------------------------------------- +// DOMErrorImpl: Setter methods +// --------------------------------------------------------------------------- +void DOMErrorImpl::setLocation(DOMLocator* const location) +{ + if (fAdoptLocation) + delete fLocation; + + fLocation = location; +} diff --git a/src/xercesc/dom/impl/DOMErrorImpl.hpp b/src/xercesc/dom/impl/DOMErrorImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d25f2d7ca1d52d42ff446d0461a7eda51f3cf5c4 --- /dev/null +++ b/src/xercesc/dom/impl/DOMErrorImpl.hpp @@ -0,0 +1,220 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache\@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation, and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com . For more information + * on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +/* + * $Log$ + * Revision 1.1 2002/05/23 15:47:24 knoaman + * DOM L3 core - support for DOMError, DOMErrorHandler and DOMLocator + * + */ + + +#ifndef DOMERRORIMPL_HPP +#define DOMERRORIMPL_HPP + +#include <xercesc/dom/DOMError.hpp> + +/** + * Implementation of a DOMError interface. + * + * @see DOMError#DOMError + */ + +class CDOM_EXPORT DOMErrorImpl : public DOMError +{ +public: + /** @name Constructors and Destructor */ + //@{ + + /** Constructors */ + DOMErrorImpl(const short severity); + + DOMErrorImpl + ( + const short severity + , const XMLCh* const message + , DOMLocator* const location + ); + + /** Desctructor */ + virtual ~DOMErrorImpl(); + + //@} + + /** @name Get function */ + //@{ + + /** + * Get the severity of the error + */ + virtual short getSeverity() const; + + /** + * Get the message describing the error that occured. + */ + virtual const XMLCh* getMessage() const; + + /** + * Get the location of the error + */ + virtual DOMLocator* getLocation() const; + + //@} + + + /** @name Set function */ + //@{ + + /** + * Set the severity of the error + * + * @param severity the type of the error to set + */ + virtual void setSeverity(const short severity); + + /** + * Set the error message + * + * @param message the error message to set. + */ + virtual void setMessage(const XMLCh* const message); + + /** + * Set the location of the error + * + * @param location the location of the error to set. + */ + virtual void setLocation(DOMLocator* const location); + + /** + * 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. + */ + void setAdoptLocation(const bool value); + + //@} + + +private : + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + DOMErrorImpl(const DOMErrorImpl&); + + /* Assignment operator */ + void operator=(const DOMErrorImpl&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fAdoptLocation + // Indicates whether we own the DOMLocator object or not. + // + // fSeverity + // The type of the error. + // + // fMessage + // The error message + // + // fLocation + // The location info of the error + // ----------------------------------------------------------------------- + bool fAdoptLocation; + short fSeverity; + const XMLCh* fMessage; + DOMLocator* fLocation; +}; + +// --------------------------------------------------------------------------- +// DOMErrorImpl: Getter methods +// --------------------------------------------------------------------------- +inline short DOMErrorImpl::getSeverity() const +{ + return fSeverity; +} + +inline const XMLCh* DOMErrorImpl::getMessage() const +{ + return fMessage; +} + +inline DOMLocator* DOMErrorImpl::getLocation() const +{ + return fLocation; +} + +// --------------------------------------------------------------------------- +// DOMLocatorImpl: Setter methods +// --------------------------------------------------------------------------- +inline void DOMErrorImpl::setSeverity(const short severity) +{ + fSeverity = severity; +} + +inline void DOMErrorImpl::setMessage(const XMLCh* const message) +{ + fMessage = message; +} + +inline void DOMErrorImpl::setAdoptLocation(const bool value) +{ + fAdoptLocation = value; +} + + +#endif diff --git a/src/xercesc/dom/impl/DOMLocatorImpl.cpp b/src/xercesc/dom/impl/DOMLocatorImpl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8bd17aa265635bf54ee7fff446e9acabf5290361 --- /dev/null +++ b/src/xercesc/dom/impl/DOMLocatorImpl.cpp @@ -0,0 +1,95 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache\@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation, and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com . For more information + * on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +/* + * $Log$ + * Revision 1.1 2002/05/23 15:47:24 knoaman + * DOM L3 core - support for DOMError, DOMErrorHandler and DOMLocator + * + */ + +#include <xercesc/dom/impl/DOMLocatorImpl.hpp> + +// --------------------------------------------------------------------------- +// DOMLocatorImpl: Constructors and Destructor +// --------------------------------------------------------------------------- +DOMLocatorImpl::DOMLocatorImpl() : +fLineNum(-1) +, fColumnNum(-1) +, fOffset(-1) +, fErrorNode(0) +, fURI(0) +{ +} + + +DOMLocatorImpl::DOMLocatorImpl(const long lineNum, + const long columnNum, + DOMNode* const errorNode, + const XMLCh* const uri, + const long offset) : +fLineNum(lineNum) +, fColumnNum(columnNum) +, fOffset(offset) +, fErrorNode(errorNode) +, fURI(uri) +{ +} + +DOMLocatorImpl::~DOMLocatorImpl() +{ +} + diff --git a/src/xercesc/dom/impl/DOMLocatorImpl.hpp b/src/xercesc/dom/impl/DOMLocatorImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c01ccf4e371a2a27d9e3bef468244a663d736d1e --- /dev/null +++ b/src/xercesc/dom/impl/DOMLocatorImpl.hpp @@ -0,0 +1,290 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache\@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation, and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com . For more information + * on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +/* + * $Log$ + * Revision 1.1 2002/05/23 15:47:24 knoaman + * DOM L3 core - support for DOMError, DOMErrorHandler and DOMLocator + * + */ + + +#ifndef DOMLOCATORIMPL_HPP +#define DOMLOCATORIMPL_HPP + +#include <xercesc/dom/DOMLocator.hpp> + + +/** + * Implementation of a DOMLocator interface. + * + * @see DOMLocator#DOMLocator + */ + +class CDOM_EXPORT DOMLocatorImpl : public DOMLocator +{ +public: + /** @name Constructors and Destructor */ + //@{ + + /** Constructor */ + DOMLocatorImpl(); + + DOMLocatorImpl + ( + const long lineNum + , const long columnNum + , DOMNode* const errorNode + , const XMLCh* const uri + , const long offset = -1 + ); + + /** Desctructor */ + virtual ~DOMLocatorImpl(); + + //@} + + /** @name Get function */ + //@{ + + /** + * Get the line number where the error occured. The value is -1 if there is + * no line number available. + * + * @see #setLineNumber + */ + virtual long getLineNumber() const; + + /** + * Get the column number where the error occured. The value is -1 if there + * is no column number available. + * + * @see #setColumnNumber + */ + virtual long getColumnNumber() const; + + /** + * Get the byte or character offset into the input source, if we're parsing + * a file or a byte stream then this will be the byte offset into that + * stream, but if a character media is parsed then the offset will be the + * character offset. The value is -1 if there is no offset available. + * + * @see #setOffset + */ + virtual long getOffset() const; + + /** + * Get the DOM Node where the error occured, or <code>null</code> if there + * is no node available. + * + * @see #setErrorNode + */ + virtual DOMNode* getErrorNode() const; + + /** + * Get the URI where the error occured, or <code>null</code> if there is no + * URI available. + * + * @see #setURI + */ + virtual const XMLCh* getURI() const; + + //@} + + + /** @name Set function */ + //@{ + + /** + * Set the line number of the error + * + * @param lineNumber the line number to set + * + * @see #getLinNumner + */ + virtual void setLineNumber(const long lineNumber); + + /** + * Set the column number of the error + * + * @param columnNumber the column number to set. + * + * @see #getColumnNumner + */ + virtual void setColumnNumber(const long columnNumber); + + /** + * Set the byte/character offset. + * + * @param offset the byte/characte offset to set. + * + * @see #getOffset + */ + virtual void setOffset(const long offset); + + /** + * Set the DOM Node where the error occured + * + * @param errorNode the DOM Node to set + * + * @see #getErrorNode + */ + virtual void setErrorNode(DOMNode* const errorNode); + + /** + * Set the URI where the error occured + * + * @param uri the URI to set. + * + * @see #getURI + */ + virtual void setURI(const XMLCh* const uri); + + //@} + + +private : + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + DOMLocatorImpl(const DOMLocatorImpl&); + + /* Assignment operator */ + void operator=(const DOMLocatorImpl&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fLineNum + // fColumnNum + // Track line/column number of where the error occured + // + // fOffset + // Track character/byte offset in the input source where the error + // occured + // + // fErrorNode + // Current error node where the error occured + // + // fURI + // The uri where the error occured + // ----------------------------------------------------------------------- + long fLineNum; + long fColumnNum; + long fOffset; + DOMNode* fErrorNode; + const XMLCh* fURI; +}; + + +// --------------------------------------------------------------------------- +// DOMLocatorImpl: Getter methods +// --------------------------------------------------------------------------- +inline long DOMLocatorImpl::getLineNumber() const +{ + return fLineNum; +} + +inline long DOMLocatorImpl::getColumnNumber() const +{ + return fColumnNum; +} + +inline long DOMLocatorImpl::getOffset() const +{ + return fOffset; +} + +inline DOMNode* DOMLocatorImpl::getErrorNode() const +{ + return fErrorNode; +} + +inline const XMLCh* DOMLocatorImpl::getURI() const +{ + return fURI; +} + + +// --------------------------------------------------------------------------- +// DOMLocatorImpl: Setter methods +// --------------------------------------------------------------------------- +inline void DOMLocatorImpl::setLineNumber(const long lineNumber) +{ + fLineNum = lineNumber; +} + +inline void DOMLocatorImpl::setColumnNumber(const long columnNumber) +{ + fColumnNum = columnNumber; +} + +inline void DOMLocatorImpl::setOffset(const long offset) +{ + fOffset = offset; +} + +inline void DOMLocatorImpl::setErrorNode(DOMNode* const errorNode) +{ + fErrorNode = errorNode; +} + +inline void DOMLocatorImpl::setURI(const XMLCh* const uri) +{ + fURI = uri; +} + +#endif diff --git a/src/xercesc/dom/impl/Makefile.in b/src/xercesc/dom/impl/Makefile.in index 166ac48b8025b21de919e218b9f913d8249fe319..b7e5169ab865ba8d38fabadec6fd3f44fab387af 100644 --- a/src/xercesc/dom/impl/Makefile.in +++ b/src/xercesc/dom/impl/Makefile.in @@ -98,6 +98,8 @@ DOM_IMPL_CPP_PRIVHEADERS = \ DOMElementNSImpl.hpp \ DOMEntityImpl.hpp \ DOMEntityReferenceImpl.hpp \ + DOMErrorImpl.hpp \ + DOMLocatorImpl.hpp \ DOMNamedNodeMapImpl.hpp \ DOMNodeIDMap.hpp \ DOMNodeImpl.hpp \ @@ -134,6 +136,8 @@ DOM_IMPL_CPP_OBJECTS = \ DOMElementNSImpl.$(TO) \ DOMEntityImpl.$(TO) \ DOMEntityReferenceImpl.$(TO) \ + DOMErrorImpl.$(TO) \ + DOMLocatorImpl.$(TO) \ DOMNamedNodeMapImpl.$(TO) \ DOMNodeIDMap.$(TO) \ DOMNodeImpl.$(TO) \