Author: amassari
Date: Wed Aug 31 03:31:17 2005
New Revision: 265005

URL: http://svn.apache.org/viewcvs?rev=265005&view=rev
Log:
DOM L3 Core: DOMUserDataHandler, DOMError, DOMErrorHandler, DOMLocator

Modified:
    xerces/c/trunk/src/xercesc/dom/DOMError.hpp
    xerces/c/trunk/src/xercesc/dom/DOMErrorHandler.hpp
    xerces/c/trunk/src/xercesc/dom/DOMLocator.hpp
    xerces/c/trunk/src/xercesc/dom/DOMUserDataHandler.hpp
    xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
    xerces/c/trunk/src/xercesc/dom/impl/DOMErrorImpl.hpp
    xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp
    xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.cpp
    xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.hpp
    xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp
    xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp

Modified: xerces/c/trunk/src/xercesc/dom/DOMError.hpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/DOMError.hpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/DOMError.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/DOMError.hpp Wed Aug 31 03:31:17 2005
@@ -78,13 +78,29 @@
     /**
      * The severity of the error described by the <code>DOMError</code>.
      *
+     * <p><code>DOM_SEVERITY_ERROR:</code>
+     * The severity of the error described by the <code>DOMError</code> is 
error. 
+     * A DOM_SEVERITY_ERROR may not cause the processing to stop if the error 
can 
+     * be recovered, unless <code>DOMErrorHandler::handleError()</code> 
returns false.</p>
+     *
+     * <p><code>DOM_SEVERITY_FATAL_ERROR</code>
+     * The severity of the error described by the <code>DOMError</code> is 
fatal error. 
+     * A DOM_SEVERITY_FATAL_ERROR will cause the normal processing to stop. 
The return 
+     * value of <code>DOMErrorHandler::handleError()</code> is ignored unless 
the 
+     * implementation chooses to continue, in which case the behavior becomes 
undefined.</p>
+     *
+     * <p><code>DOM_SEVERITY_WARNING</code>
+     * The severity of the error described by the <code>DOMError</code> is 
warning. 
+     * A DOM_SEVERITY_WARNING will not cause the processing to stop, unless 
+     * <code>DOMErrorHandler::handleError()</code> returns false.</p>
+     *
      * @since DOM Level 3
      */
     enum ErrorSeverity
     {
-        DOM_SEVERITY_WARNING     = 0,
-        DOM_SEVERITY_ERROR       = 1,
-        DOM_SEVERITY_FATAL_ERROR = 2
+        DOM_SEVERITY_WARNING     = 1,
+        DOM_SEVERITY_ERROR       = 2,
+        DOM_SEVERITY_FATAL_ERROR = 3
     };
     //@}
 
@@ -100,8 +116,6 @@
     /**
      * Get the severity of the error
      *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
      * @see   setSeverity
      * @since DOM Level 3
      */
@@ -110,9 +124,6 @@
     /**
      * Get the message describing the error that occured.
      *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @see   setMessage
      * @since DOM Level 3
      */
     virtual const XMLCh* getMessage() const = 0;
@@ -120,9 +131,6 @@
     /**
      * Get the location of the error
      *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @see   setLocation
      * @since DOM Level 3
      */
     virtual DOMLocator* getLocation() const = 0;
@@ -130,9 +138,6 @@
     /**
      * The related platform dependent exception if any.
      *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @see   setRelatedException
      * @since DOM Level 3
      */
     virtual void* getRelatedException() const = 0;
@@ -143,106 +148,22 @@
      * 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>
+     * Note: As an example, <code>DOMDocument::normalizeDocument()</code> does 
generate 
+     * warnings when the "split-cdata-sections" parameter is in use. 
Therefore, the 
+     * method generates a DOM_SEVERITY_WARNING with type 
"cdata-sections-splitted" 
+     * and the first <code>DOMCDATASection</code> node in document order 
resulting from the split 
+     * is returned by the relatedData attribute.
      *
-     * @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>
+     * The related DOMError::getType dependent data if any.
      *
-     * @see   setRelatedData
      * @since DOM Level 3
      */
     virtual void* getRelatedData() const = 0;
-
-
-    // -----------------------------------------------------------------------
-    //  Setter methods
-    // -----------------------------------------------------------------------
-    /**
-     * Set the severity of the error
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param severity the type of the error to set
-     * @see   getLocation
-     * @since DOM Level 3
-     */
-    virtual void setSeverity(const short severity) = 0;
-
-    /**
-     * Set the error message
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param message the error message to set.
-     * @see   getMessage
-     * @since DOM Level 3
-     */
-    virtual void setMessage(const XMLCh* const message) = 0;
-
-    /**
-     * Set the location of the error
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param location the location of the error to set.
-     * @see   getLocation
-     * @since DOM Level 3
-     */
-    virtual void setLocation(DOMLocator* const location) = 0;
-
-    /**
-     * The related platform dependent exception if any.
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param exc the related exception to set.
-     * @see   getRelatedException
-     * @since DOM Level 3
-     */
-    virtual void setRelatedException(void* exc) 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;
-
     //@}
 
 };

Modified: xerces/c/trunk/src/xercesc/dom/DOMErrorHandler.hpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/DOMErrorHandler.hpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/DOMErrorHandler.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/DOMErrorHandler.hpp Wed Aug 31 03:31:17 2005
@@ -84,8 +84,7 @@
     //@{
     /**
      * This method is called on the error handler when an error occures.
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
+     * If an exception is thrown from this method, it is considered to be 
equivalent of returning <code>true</code>.
      *
      * @param domError The error object that describes the error, this object
      *                 may be reused by the DOM implementation across multiple

Modified: xerces/c/trunk/src/xercesc/dom/DOMLocator.hpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/DOMLocator.hpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/DOMLocator.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/DOMLocator.hpp Wed Aug 31 03:31:17 2005
@@ -80,125 +80,51 @@
     //  Getter methods
     // -----------------------------------------------------------------------
     /**
-     * Get the line number where the error occured. The value is -1 if there is
+     * Get the line number where the error occured, or -1 if there is
      * no line number available.
      *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @see #setLineNumber
      * @since DOM Level 3
      */
     virtual XMLSSize_t getLineNumber() const = 0;
 
     /**
-     * Get the column number where the error occured. The value is -1 if there
+     * Get the column number where the error occured, or -1 if there
      * is no column number available.
      *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @see #setColumnNumber
      * @since DOM Level 3
      */
     virtual XMLSSize_t 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.
+     * Get the byte offset into the input source, or -1 if there is no byte 
offset available.
      *
-     * <p><b>"Experimental - subject to change"</b></p>
+     * @since DOM Level 3
+     */
+    virtual XMLSSize_t getByteOffset() const = 0;
+
+    /**
+     * Get the UTF-16 offset into the input source, or -1 if there is no 
UTF-16 offset available.
      *
-     * @see #setOffset
      * @since DOM Level 3
      */
-    virtual XMLSSize_t getOffset() const = 0;
+    virtual XMLSSize_t getUtf16Offset() const = 0;
 
     /**
      * Get the DOMNode where the error occured, or <code>null</code> if there
      * is no node available.
      *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @see #setErrorNode
      * @since DOM Level 3
      */
-    virtual DOMNode* getErrorNode() const = 0;
+    virtual DOMNode* getRelatedNode() const = 0;
 
     /**
      * Get the URI where the error occured, or <code>null</code> if there is no
      * URI available.
      *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
      * @see #setURI
      * @since DOM Level 3
      */
     virtual const XMLCh* getURI() const = 0;
-
-    // -----------------------------------------------------------------------
-    //  Setter methods
-    // -----------------------------------------------------------------------
-    /**
-     * Set the line number of the error
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param lineNumber the line number to set
-     *
-     * @see #getLinNumner
-     * @since DOM Level 3
-     */
-    virtual void setLineNumber(const XMLSSize_t lineNumber) = 0;
-
-    /**
-     * Set the column number of the error
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param columnNumber the column number to set.
-     *
-     * @see #getColumnNumner
-     * @since DOM Level 3
-     */
-    virtual void setColumnNumber(const XMLSSize_t columnNumber) = 0;
-
-    /**
-     * Set the byte/character offset.
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param offset the byte/characte offset to set.
-     *
-     * @see #getOffset
-     * @since DOM Level 3
-     */
-    virtual void setOffset(const XMLSSize_t offset) = 0;
-
-    /**
-     * Set the DOMNode where the error occured
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param errorNode the DOMNode to set
-     *
-     * @see #getErrorNode
-     * @since DOM Level 3
-     */
-    virtual void setErrorNode(DOMNode* const errorNode) = 0;
-
-    /**
-     * Set the URI where the error occured
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param uri the URI to set.
-     *
-     * @see #getURI
-     * @since DOM Level 3
-     */
-    virtual void setURI(const XMLCh* const uri) = 0;
-
     //@}
 };
 

Modified: xerces/c/trunk/src/xercesc/dom/DOMUserDataHandler.hpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/DOMUserDataHandler.hpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/DOMUserDataHandler.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/DOMUserDataHandler.hpp Wed Aug 31 03:31:17 
2005
@@ -33,8 +33,6 @@
  * the application to implement various behaviors regarding the data it
  * associates to the DOM nodes. This interface defines that handler.
  *
- * <p><b>"Experimental - subject to change"</b></p>
- *
  * <p>See also the <a 
href='http://www.w3.org/2001/07/WD-DOM-Level-3-Core-20010726'>Document Object 
Model (DOM) Level 3 Core Specification</a>.
  * @since DOM Level 3
  */
@@ -91,7 +89,8 @@
      * <p><code>NODE_RENAMED</code>
      * The node is renamed.
      *
-     * <p><b>"Experimental - subject to change"</b></p>
+     * <p><code>NODE_ADOPTED</code>
+     * The node is adopted.
      *
      * @since DOM Level 3
      */
@@ -99,7 +98,8 @@
         NODE_CLONED               = 1,
         NODE_IMPORTED             = 2,
         NODE_DELETED              = 3,
-        NODE_RENAMED              = 4
+        NODE_RENAMED              = 4,
+        NODE_ADOPTED              = 5
     };
     //@}
 
@@ -113,14 +113,14 @@
      * This method is called whenever the node for which this handler is
      * registered is imported or cloned.
      *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
      * @param operation Specifies the type of operation that is being
      *   performed on the node.
      * @param key Specifies the key for which this handler is being called.
      * @param data Specifies the data for which this handler is being called.
-     * @param src Specifies the node being cloned, imported, or renamed.
-     * @param dst Specifies the node newly created.
+     * @param src Specifies the node being cloned, adopted, imported, or 
renamed.
+     *            This is <code>null</code> when the node is being deleted.
+     * @param dst Specifies the node newly created if any, or 
<code>null</code>.
+     *
      * @since DOM Level 3
      */
     virtual void handle(DOMOperationType operation,

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp Wed Aug 31 03:31:17 
2005
@@ -992,6 +992,7 @@
             DOMElement* sourceAttrElem=sourceAttr->getOwnerElement();
             if(sourceAttrElem)
                 sourceAttrElem->removeAttributeNode(sourceAttr);
+            fNode.callUserDataHandlers(DOMUserDataHandler::NODE_ADOPTED, 
sourceNode, sourceNode);
             break;
         }
     default:
@@ -999,6 +1000,7 @@
             DOMNode* sourceNodeParent=sourceNode->getParentNode();
             if(sourceNodeParent)
                 sourceNodeParent->removeChild(sourceNode);
+            fNode.callUserDataHandlers(DOMUserDataHandler::NODE_ADOPTED, 
sourceNode, sourceNode);
         }
     }
     return 0;

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMErrorImpl.hpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/impl/DOMErrorImpl.hpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMErrorImpl.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMErrorImpl.hpp Wed Aug 31 03:31:17 
2005
@@ -63,98 +63,22 @@
 
     //@}
 
-    /** @name Get function */
-    //@{
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Get the severity of the error
-    */
+    // DOMError interface
     virtual short getSeverity() const;
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Get the message describing the error that occured.
-    */
     virtual const XMLCh* getMessage() const;
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Get the location of the error
-    */
     virtual DOMLocator* getLocation() const;
-
-    /**
-     * The related platform dependent exception if any.
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @see   setRelatedException
-     * @since DOM Level 3
-     */
     virtual void* getRelatedException() const;
-
     virtual const XMLCh* getType() const;
-
     virtual void* getRelatedData() const;
 
-    //@}
-
-
-   /** @name Set function */
-    //@{
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Set the severity of the error
-    *
-    * @param severity the type of the error to set
-    */
-    virtual void setSeverity(const short severity);
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Set the error message
-    *
-    * @param message the error message to set.
-    */
-    virtual void setMessage(const XMLCh* const message);
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Set the location of the error
-    *
-    * @param location the location of the error to set.
-    */
-    virtual void setLocation(DOMLocator* const location);
-
-   /**
-    * @param value <code>true</code> if DOMLocator is owned and should be
-    *              deleted, <code>false</code> otherwise.
-    */
+    // Setters
+    void setSeverity(const short severity);
+    void setMessage(const XMLCh* const message);
+    void setLocation(DOMLocator* const location);
     void setAdoptLocation(const bool value);
-
-    /**
-     * The related platform dependent exception if any.
-     *
-     * <p><b>"Experimental - subject to change"</b></p>
-     *
-     * @param exc the related exception to set.
-     * @see   getRelatedException
-     * @since DOM Level 3
-     */
-    virtual void setRelatedException(void* exc) const;
-
-    virtual void setType(const XMLCh* type);
-
-    virtual void setRelatedData(void* relatedData);
-
+    void setRelatedException(void* exc) const;
+    void setType(const XMLCh* type);
+    void setRelatedData(void* relatedData);
 
 private :
     /* Unimplemented constructors and operators */

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp Wed Aug 31 
03:31:17 2005
@@ -1412,9 +1412,15 @@
 
     if (fErrorHandler)
     {
-        DOMLocatorImpl  locator(0, 0, (DOMNode* const) errorNode, 0, 0);
+        DOMLocatorImpl  locator(-1, -1, (DOMNode* const) errorNode, 0);
         DOMErrorImpl    domError(errorType , errorMsg, &locator);
-        toContinueProcess = fErrorHandler->handleError(domError);
+        try
+        {
+            toContinueProcess = fErrorHandler->handleError(domError);
+        }
+        catch(...)
+        {
+        }
     }
 
     if (errorType != DOMError::DOM_SEVERITY_WARNING)
@@ -1436,9 +1442,15 @@
 
     if (fErrorHandler)
     {
-        DOMLocatorImpl  locator(0, 0, (DOMNode* const) errorNode, 0, 0);
+        DOMLocatorImpl  locator(-1, -1, (DOMNode* const) errorNode, 0);
         DOMErrorImpl    domError(errorType , errText, &locator);
-        toContinueProcess = fErrorHandler->handleError(domError);
+        try
+        {
+            toContinueProcess = fErrorHandler->handleError(domError);
+        }
+        catch(...)
+        {
+        }
     }
 
     if (errorType != DOMError::DOM_SEVERITY_WARNING)

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.cpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.cpp Wed Aug 31 03:31:17 
2005
@@ -29,8 +29,9 @@
 DOMLocatorImpl::DOMLocatorImpl() :
 fLineNum(-1)
 , fColumnNum(-1)
-, fOffset(-1)
-, fErrorNode(0)
+, fByteOffset(-1)
+, fUtf16Offset(-1)
+, fRelatedNode(0)
 , fURI(0)
 {
 }
@@ -40,11 +41,13 @@
                                const XMLSSize_t columnNum,
                                DOMNode* const errorNode,
                                const XMLCh* const uri,
-                               const XMLSSize_t offset) :
+                               const XMLSSize_t byteOffset,
+                               const XMLSSize_t utf16Offset) :
 fLineNum(lineNum)
 , fColumnNum(columnNum)
-, fOffset(offset)
-, fErrorNode(errorNode)
+, fByteOffset(byteOffset)
+, fUtf16Offset(utf16Offset)
+, fRelatedNode(errorNode)
 , fURI(uri)
 {
 }

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.hpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.hpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMLocatorImpl.hpp Wed Aug 31 03:31:17 
2005
@@ -52,6 +52,7 @@
         , DOMNode* const errorNode
         , const XMLCh* const uri
         , const XMLSSize_t offset = -1
+        , const XMLSSize_t utf16Offset = -1
     );
 
     /** Desctructor */
@@ -59,123 +60,21 @@
 
     //@}
 
-    /** @name Get function */
-    //@{
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Get the line number where the error occured. The value is -1 if there is
-    * no line number available.
-    *
-    * @see #setLineNumber
-    */
+    // DOMLocator interface
     virtual XMLSSize_t getLineNumber() const;
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Get the column number where the error occured. The value is -1 if there
-    * is no column number available.
-    *
-    * @see #setColumnNumber
-    */
     virtual XMLSSize_t getColumnNumber() const;
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * 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 XMLSSize_t getOffset() const;
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Get the DOM Node where the error occured, or <code>null</code> if there
-    * is no node available.
-    *
-    * @see #setErrorNode
-    */
-    virtual DOMNode* getErrorNode() const;
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Get the URI where the error occured, or <code>null</code> if there is no
-    * URI available.
-    *
-    * @see #setURI
-    */
+    virtual XMLSSize_t getByteOffset() const;
+    virtual XMLSSize_t getUtf16Offset() const;
+    virtual DOMNode* getRelatedNode() const;
     virtual const XMLCh* getURI() const;
 
-    //@}
-
-
-   /** @name Set function */
-    //@{
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Set the line number of the error
-    *
-    * @param lineNumber the line number to set
-    *
-    * @see #getLinNumner
-    */
-    virtual void setLineNumber(const XMLSSize_t lineNumber);
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Set the column number of the error
-    *
-    * @param columnNumber the column number to set.
-    *
-    * @see #getColumnNumner
-    */
-    virtual void setColumnNumber(const XMLSSize_t columnNumber);
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Set the byte/character offset.
-    *
-    * @param offset the byte/characte offset to set.
-    *
-    * @see #getOffset
-    */
-    virtual void setOffset(const XMLSSize_t offset);
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Set the DOM Node where the error occured
-    *
-    * @param errorNode the DOM Node to set
-    *
-    * @see #getErrorNode
-    */
-    virtual void setErrorNode(DOMNode* const errorNode);
-
-   /**
-    * <p><b>"Experimental - subject to change"</b></p>
-    *
-    * Set the URI where the error occured
-    *
-    * @param uri the URI to set.
-    *
-    * @see #getURI
-    */
-    virtual void setURI(const XMLCh* const uri);
-
-    //@}
+    // Setter functions
+    void setLineNumber(const XMLSSize_t lineNumber);
+    void setColumnNumber(const XMLSSize_t columnNumber);
+    void setByteOffset(const XMLSSize_t offset);
+    void setUtf16Offset(const XMLSSize_t offset);
+    void setRelatedNode(DOMNode* const errorNode);
+    void setURI(const XMLCh* const uri);
 
 
 private :
@@ -194,20 +93,25 @@
     //  fColumnNum
     //      Track line/column number of where the error occured
     //
-    //  fOffset
-    //      Track character/byte offset in the input source where the error
+    //  fByteOffset
+    //      Track byte offset in the input source where the error
     //      occured
     //
-    //  fErrorNode
-    //      Current error node where the error occured
+    //  fUtf16Offset
+    //      Track character offset in the input source where the error
+    //      occured
+    //
+    //  fRelatedNode
+    //      Current node where the error occured
     //
     //  fURI
     //      The uri where the error occured
     // -----------------------------------------------------------------------
     XMLSSize_t   fLineNum;
     XMLSSize_t   fColumnNum;
-    XMLSSize_t   fOffset;
-    DOMNode*     fErrorNode;
+    XMLSSize_t   fByteOffset;
+    XMLSSize_t   fUtf16Offset;
+    DOMNode*     fRelatedNode;
     const XMLCh* fURI;
 };
 
@@ -225,14 +129,19 @@
     return fColumnNum;
 }
 
-inline XMLSSize_t DOMLocatorImpl::getOffset() const
+inline XMLSSize_t DOMLocatorImpl::getByteOffset() const
+{
+    return fByteOffset;
+}
+
+inline XMLSSize_t DOMLocatorImpl::getUtf16Offset() const
 {
-    return fOffset;
+    return fUtf16Offset;
 }
 
-inline DOMNode* DOMLocatorImpl::getErrorNode() const
+inline DOMNode* DOMLocatorImpl::getRelatedNode() const
 {
-    return fErrorNode;
+    return fRelatedNode;
 }
 
 inline const XMLCh* DOMLocatorImpl::getURI() const
@@ -254,14 +163,19 @@
     fColumnNum = columnNumber;
 }
 
-inline void DOMLocatorImpl::setOffset(const XMLSSize_t offset)
+inline void DOMLocatorImpl::setByteOffset(const XMLSSize_t offset)
+{
+    fByteOffset = offset;
+}
+
+inline void DOMLocatorImpl::setUtf16Offset(const XMLSSize_t offset)
 {
-    fOffset = offset;
+    fUtf16Offset = offset;
 }
 
-inline void DOMLocatorImpl::setErrorNode(DOMNode* const errorNode)
+inline void DOMLocatorImpl::setRelatedNode(DOMNode* const errorNode)
 {
-    fErrorNode = errorNode;
+    fRelatedNode = errorNode;
 }
 
 inline void DOMLocatorImpl::setURI(const XMLCh* const uri)

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp Wed Aug 31 03:31:17 
2005
@@ -544,7 +544,15 @@
         }
 
         DOMErrorImpl domError(code, 0, errText, (void*)node);
-        if (!fErrorHandler->handleError(domError))
+        bool toContinueProcess = true;
+        try
+        {
+            toContinueProcess = fErrorHandler->handleError(domError);
+        }
+        catch(...)
+        {
+        }
+        if (!toContinueProcess)
             throw (XMLErrs::Codes) code;
     }
 }

Modified: xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp?rev=265005&r1=265004&r2=265005&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp Wed Aug 31 03:31:17 
2005
@@ -761,10 +761,20 @@
             severity = DOMError::DOM_SEVERITY_FATAL_ERROR;
 
         DOMLocatorImpl location((int)lineNum, (int) colNum, getCurrentNode(), 
systemId);
+        if(getScanner()->getCalculateSrcOfs())
+            location.setByteOffset(getScanner()->getSrcOffset());
         DOMErrorImpl domError(severity, errorText, &location);
 
         // if user return false, we should stop the process, so throw an error
-        if (!fErrorHandler->handleError(domError) && 
!getScanner()->getInException())
+        bool toContinueProcess = true;
+        try
+        {
+            toContinueProcess = fErrorHandler->handleError(domError);
+        }
+        catch(...)
+        {
+        }
+        if (!toContinueProcess && !getScanner()->getInException())
             throw (XMLErrs::Codes) code;
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to