Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-948

Reporting of DOMLocator.relatedNode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.6.2
    • 2.6.2
    • DOM (Level 3 Core)
    • None

    Description

      DOMNormalizer and DOMSerializerImpl make use of the method reportDOMError to report a DOMError to the error handler. This method has a relatedNode parameter in addition to being passed a DOMLocator object.

      Currently, W3C DOM test documentnormalizedocument07 is failing because normalizeNode calls isCDataWF, sending the nodeValue (containing "]]>") as a string, but the isCDataWF method does not receive the actual CDATA node as a parameter. isCDataWF subsequently calls reportDOMError passing null for the value of the relatedNode parameter, instead of the expected problem CDATA node.

      In the proposed patch, reportDOMError no longer takes relatedNode as a parameter, as this should be available in the Locator passed to it. The actual setting of relatedNode takes place in normalizeNode (in DOMNormalizer) and verify (in DOMSerializeImpl) above the switch statement. In a few instances, (such as when invalid characters are present in an attribute name), the value of relatedNode must be explicitly overridden to the value of a specific node. Not sure if this is the best way to handle things, since Locator data members would have to stay public.

      Aside, I think it should still be okay for reportDOMError to set the value of relatedData to that of relatedNode, as the spec states that "When called, DOMError.relatedData will contain the closest node to where the error occurred" [1], although I know elsewhere it says relatedData is of type DOMObject

      [1]http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#parameter-error-handler

      Attachments

        1. relatedNodepatch.txt
          24 kB
          Naela Nissar

        Activity

          People

            mrglavas@ca.ibm.com Michael Glavassevich
            naela Naela Nissar
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: