Example #1
0
 // Sets up instance variables that haven't been set by setFeature
 private void Setup() {
   if (_schema == null) {
     _schema = new HTMLSchema();
   }
   if (_scanner == null) {
     _scanner = new HTMLScanner();
   }
   if (_autoDetector == null) {
     _autoDetector = new AutoDetectorDelegate(stream => new StreamReader(stream));
   }
   _stack = new Element(_schema.GetElementType("<root>"), _defaultAttributes);
   _pcdata = new Element(_schema.GetElementType("<pcdata>"), _defaultAttributes);
   _newElement = null;
   _attributeName = null;
   _piTarget = null;
   _saved = null;
   _entity = 0;
   _virginStack = true;
   _doctypeName = _doctypePublicId = _doctypeSystemId = null;
 }
Example #2
0
 public void SetProperty(string name, object value) {
   if (name.Equals(LEXICAL_HANDLER_PROPERTY)) {
     if (value == null) {
       _lexicalHandler = this;
     } else {
       var handler = value as ILexicalHandler;
       if (handler != null) {
         _lexicalHandler = handler;
       } else {
         throw new SAXNotSupportedException("Your lexical handler is not a ILexicalHandler");
       }
     }
   } else if (name.Equals(SCANNER_PROPERTY)) {
     var scanner = value as IScanner;
     if (scanner != null) {
       _scanner = scanner;
     } else {
       throw new SAXNotSupportedException("Your scanner is not a IScanner");
     }
   } else if (name.Equals(SCHEMA_PROPERTY)) {
     var schema = value as Schema;
     if (schema != null) {
       _schema = schema;
     } else {
       throw new SAXNotSupportedException("Your schema is not a Schema");
     }
   } else if (name.Equals(AUTO_DETECTOR_PROPERTY)) {
     var detector = value as IAutoDetector;
     if (detector != null) {
       _autoDetector = detector;
     } else {
       throw new SAXNotSupportedException("Your auto-detector is not an IAutoDetector");
     }
   } else {
     throw new SAXNotRecognizedException("Unknown property " + name);
   }
 }