Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1535

DOMCountErrorHandler::handleError - Report wrong error node in domError.getLocation()->getErrorNode()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 2.7.0
    • None
    • None
    • Windowx XP, SuSE Linux 9.2

    Description

      I have XML+DTD and this XML is not valid against DTD:

      <?xml version="1.0" encoding="utf-8" ?>
      <!DOCTYPE note [
      <!ELEMENT note (to,from)>
      <!ELEMENT to (#PCDATA)>
      <!ELEMENT from (#PCDATA)>
      ]>
      <note><to>Tove</to><from not_declared="xxx">Jani</from></note>

      Element "from" contain undeclared attribute. Now I open XML and see what DOMCountErrorHandler::handleError says:

      — C code begin:
      bool DOMCountErrorHandler::handleError(const DOMError& domError)
      {
      XERCES_STD_QUALIFIER cerr << "\n Message: " << StrX(domError.getMessage())
      << "\n node name: " << StrX(domError.getLocation()>getErrorNode()>getNodeName())
      << XERCES_STD_QUALIFIER endl;
      }
      — C code end

      Output is:
      Message: Attribute 'not_declared' is not declared for element 'from' <<--- This is true
      node name: to <<--- Reported wrong node name !!!

      As you may see, function domError.getLocation()->getErrorNode() don't return node where error occured, but their sibling DOM node.

      Lumir Vanek

      Attachments

        Activity

          People

            Unassigned Unassigned
            lvanek Lumir Vanek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: