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

Problems with SAXParser and getErrorCount

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Incomplete
    • 2.4.0
    • None
    • None
    • Operating System: Windows XP
      Platform: PC
    • 25930

    Description

      Given the following code, I create a SAXParser and call the methods as shown.

      DTDValidator *validator = new DTDValidator();
      SAXParser saxParser(validator);
      saxParser.setValidationScheme(SAXParser::Val_Always);
      saxParser.setErrorHandler(&handler);
      saxParser.setDTDHandler(&dtdHandler);
      saxParser.setDocumentHandler(saxReader);
      saxParser.parse(fileName);

      if (saxParser.getErrorCount() != 0)
      ThrowException("Invalid format or corrupted file.");

      The XML file I am reading in has an embedded DTD within it using the !DOCTYPE
      tag. When I set breakpoints in my custom DTDHandler as well as my custom
      ErrorHandler, the only methods that get called are the standard Reset ones. I
      can purposely make the file invalid by removing tags and no error calls are
      ever made to the ErrorHandler. getErrorCount never returns zero, even for a
      correct file. Is the SAXParser ignoring an embedded DTD or something? I've had
      this problem in both 2.4.0 and 1.6.0. Please advise. Thank you.

      Ryan Jackson
      Software Engineer
      Applied Technologies Associates

      Attachments

        Activity

          People

            Unassigned Unassigned
            rjackson@ata-sd.com rjackson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: