InitializeXmlReader static method

Future<XmlReader> InitializeXmlReader(
  1. Stream stream
)
Initializes the XML reader. The stream.

Implementation

static Future<XmlReader> InitializeXmlReader(Stream stream) async {
  // The ProhibitDtd property is used to indicate whether XmlReader should process DTDs or not. By default,
  // it will do so. EWS doesn't use DTD references so we want to turn this off. Also, the XmlResolver property is
  // set to an instance of XmlUrlResolver by default. We don't want XmlTextReader to try to resolve this DTD reference
  // so we disable the XmlResolver as well.
  // todo("restore xml settings")
//            XmlReaderSettings settings = new XmlReaderSettings()
//            {
//                ConformanceLevel = ConformanceLevel.Auto,
//                ProhibitDtd = true,
//                IgnoreComments = true,
//                IgnoreProcessingInstructions = true,
//                IgnoreWhitespace = true,
//                XmlResolver = null
//            };
//
//            XmlTextReader xmlTextReader = SafeXmlFactory.CreateSafeXmlTextReader(stream);
//            xmlTextReader.Normalization = false;

//            return XmlReader.Create(xmlTextReader, settings);
  return await XmlReader.Create(stream as Stream<List<int>>);
}