Skip to content
This repository was archived by the owner on Jun 18, 2024. It is now read-only.
This repository was archived by the owner on Jun 18, 2024. It is now read-only.

Invalid character reference  #353

@imario42

Description

@imario42

Not exactly an issue with the EWS Library, but the XML Parser complains about the � reference not being a correct character reference in one of the mails I had to read.

Which I worked around with the following patch.
I perfectly understand if you don't want to add this to the library by default as this will silently parse any invalid XML.
But probably a way could be added to instrument the stream and or XmlEventReader so we can setup behavior from outside of your library?

@@ -99,7 +101,14 @@ public class EwsXmlReader {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);

  • return inputFactory.createXMLEventReader(stream);
  • XMLEventReader reader = inputFactory.createXMLEventReader(stream);
  • // IM: continue after fatal error to prevent "invalid character reference" �
  • XMLErrorReporter errorReporter =
  •    (XMLErrorReporter) reader.getProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY);
    
  • errorReporter.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE, true);
  • return reader;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions