/// <summary> /// Allows an application to register an entity resolver. /// </summary> /// <param name="resolver">The entity resolver.</param> public virtual void setEntityResolver(IXmlSaxEntityResolver resolver) { this.entityResolver = resolver; }
/// <summary> /// Public constructor for the class. /// </summary> public XmlSAXDocumentManager() { isValidating = false; namespaceAllowed = false; reader = null; callBackHandler = null; errorHandler = null; locator = null; lexical = null; entityResolver = null; parserFileName = ""; }
/// <summary> /// Parses the specified stream and process the events over the specified handler, and resolves the /// entities with the specified URI. /// </summary> /// <param name="stream">The stream with the XML.</param> /// <param name="handler">The handler that manage the parser events.</param> /// <param name="URI">The namespace URI for resolve external etities.</param> public virtual void parse(System.IO.Stream stream, IXmlSaxContentHandler handler, System.String URI) { try { if (handler is XmlSaxDefaultHandler) { this.errorHandler = (XmlSaxDefaultHandler)handler; this.entityResolver = (XmlSaxDefaultHandler)handler; } if (!(this is XmlSaxParserAdapter)) this.callBackHandler = handler; else { if (this.callBackHandler == null) this.callBackHandler = handler; } this.reader = CreateXmlReader(stream, URI); this.DoParsing(); } catch (System.Xml.XmlException e) { if (this.errorHandler != null) this.errorHandler.fatalError(e); throw e; } }
/// <summary> /// Parses the specified stream and process the events over the specified handler. /// </summary> /// <param name="stream">The stream with the XML.</param> /// <param name="handler">The handler that manage the parser events.</param> public virtual void parse(Stream stream, IXmlSaxContentHandler handler) { try { if (handler is XmlSaxDefaultHandler) { errorHandler = (XmlSaxDefaultHandler) handler; entityResolver = (XmlSaxDefaultHandler) handler; } if (!(this is XmlSaxParserAdapter)) callBackHandler = handler; else { if (callBackHandler == null) callBackHandler = handler; } reader = CreateXmlReader(stream); DoParsing(); } catch (XmlException e) { if (errorHandler != null) errorHandler.fatalError(e); throw e; } }