/// <summary> /// Assigns the specified property. Like SAX1 handlers, /// these may be changed at any time. /// </summary> public virtual void SetProperty(string propertyId, object property) { try { // Properties with a defined value, we just change it if we can. GetProperty(propertyId); if ((HANDLER + "declaration-handler").Equals(propertyId)) { if (property == null) { _declHandler = _base; } else if (!(property is IDeclHandler)) { throw new SAXNotSupportedException(propertyId); } else { _declHandler = (IDeclHandler)property; } return; } if ((HANDLER + "lexical-handler").Equals(propertyId) || "http://xml.org/sax/handlers/LexicalHandler".Equals(propertyId)) { // the latter name is used in some SAX2 beta software if (property == null) { _lexicalHandler = _base; } else if (!(property is ILexicalHandler)) { throw new SAXNotSupportedException(propertyId); } else { _lexicalHandler = (ILexicalHandler)property; } return; } // can't change builtins if (_properties == null || !_properties.ContainsKey(propertyId)) { throw new SAXNotSupportedException(propertyId); } } catch (SAXNotRecognizedException e) { // as-yet unknown properties if (_properties == null) { _properties = new Hashtable(5); } } // record first value, or modify existing one _properties.Add(propertyId, property); }
/// <summary> /// Constructs a SAX Parser. /// </summary> public SAXDriver() { _entityResolver = _base; _contentHandler = _base; _dtdHandler = _base; _errorHandler = _base; _declHandler = _base; _lexicalHandler = _base; }
/// <summary> /// Assigns the specified property. Like SAX1 handlers, /// these may be changed at any time. /// </summary> public virtual void SetProperty(string propertyId, object property) { try { // Properties with a defined value, we just change it if we can. GetProperty(propertyId); if ((HANDLER + "declaration-handler").Equals(propertyId)) { if (property == null) { _declHandler = _base; } else if (! (property is IDeclHandler)) { throw new SAXNotSupportedException(propertyId); } else { _declHandler = (IDeclHandler)property; } return; } if ((HANDLER + "lexical-handler").Equals(propertyId) || "http://xml.org/sax/handlers/LexicalHandler".Equals(propertyId)) { // the latter name is used in some SAX2 beta software if (property == null) { _lexicalHandler = _base; } else if (! (property is ILexicalHandler)) { throw new SAXNotSupportedException(propertyId); } else { _lexicalHandler = (ILexicalHandler)property; } return; } // can't change builtins if (_properties == null || !_properties.ContainsKey(propertyId)) { throw new SAXNotSupportedException(propertyId); } } catch (SAXNotRecognizedException e) { // as-yet unknown properties if (_properties == null) { _properties = new Hashtable(5); } } // record first value, or modify existing one _properties.Add(propertyId, property); }
/// <summary> /// Constructs a SAX Parser. /// </summary> public SAXDriver() { _entityResolver = _base; _contentHandler = _base; _dtdHandler = _base; _errorHandler = _base; _declHandler = _base; _lexicalHandler = _base; }