コード例 #1
0
        public Indexer(Analyzer contentAnalyzer, Analyzer queryAnalyzer, IJobAdSearchBooster booster, ILocationQuery locationQuery, IIndustriesQuery industriesQuery, IJobAdFlagListsQuery jobAdFlagListsQuery)
        {
            _contentAnalyzer = contentAnalyzer;
            _queryBuilder    = new QueryBuilder(queryAnalyzer, booster);

            _contentHandler     = new ContentHandler(booster);
            _locationHandler    = new LocationContentHandler(booster, locationQuery);
            _industryHandler    = new IndustryContentHandler(booster, industriesQuery);
            _salaryHandler      = new SalaryContentHandler(booster);
            _jobTypesHandler    = new JobTypesContentHandler(booster);
            _createdTimeHandler = new CreatedTimeContentHandler(booster);
            _communityHandler   = new CommunityContentHandler(booster);
            _featuredHandler    = new FeaturedContentHandler(booster);

            _handlers = new[]
            {
                _locationHandler,
                _salaryHandler,
                _industryHandler,
                _jobTypesHandler,
                _createdTimeHandler,
                _communityHandler,
                _featuredHandler
            };

            _jobAdFlagListsQuery = jobAdFlagListsQuery;
        }
コード例 #2
0
        internal void endElement(string elname)
        {
            IContentHandler handler = contentHandler;

            if (!namespaces)
            {
                handler.EndElement("", "", elname);
                return;
            }

            string localName = string.Empty;
            string uri       = string.Empty;

            processElement(elname, out localName, out uri);
            handler.EndElement(uri, localName, elname);

            ArrayList declared = namespaceSupport.GetDeclaredPrefixes();

            foreach (string prefix in declared)
            {
                handler.EndPrefixMapping(prefix);
            }

            popContext();
        }
コード例 #3
0
        protected virtual void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = _container.Resolve <AbstractWorkspace>();
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler handler   = _dictionary[_availableNewContent[0]];
                var             openValue = handler.NewContent(_availableNewContent[0]);

                if (openValue == null)
                {
                    return;
                }

                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                throw new NotImplementedException();
            }
        }
コード例 #4
0
        public virtual void EndElement(string elname)
        {
            IContentHandler handler = _contentHandler;

            if (!_namespaces)
            {
                handler.EndElement("", "", elname);
                return;
            }

            // following code added by MHK to fix bug Saxon 6.1/013
            if (_prefixStack.ProcessName(elname, _nsTemp, false) == null)
            {
                // shouldn't happen
                _errorHandler.Error(new SAXParseException("undeclared name prefix in: " + elname, this));
                _nsTemp[0] = _nsTemp[1] = "";
                elname     = elname.Substring(elname.IndexOf(':') + 1);
            }

            handler.EndElement(_nsTemp[0], _nsTemp[1], elname);

            // previous code (clearly wrong): handler.endElement ("", "", elname);

            // end of MHK addition

            IEnumerator prefixes = _prefixStack.GetDeclaredPrefixes().GetEnumerator();

            while (prefixes.MoveNext())
            {
                handler.EndPrefixMapping((string)prefixes.Current);
            }
            _prefixStack.PopContext();
        }
コード例 #5
0
 public MainWindow()
 {
     InitializeComponent();
     _contentHandler = new TextContentHandler();
     _graphCreator = new GraphCreator();
     _huffmannEncodedMap = new ObservableCollection<DisplayData>();
     this.DataContext = _huffmannEncodedMap;
 }
コード例 #6
0
ファイル: AnimatedSprite.cs プロジェクト: ezamagni/xebab
 public AnimatedSprite(IContentHandler contentHandler, List<Polygon> shapeSet, 
     Texture2D spritesheet, Size frameSize, int timePerFrame = DEFAULT_FRAME_TIME)
     : base(contentHandler, shapeSet)
 {
     //TODO: gli ultimi 3 parametri potrebbero essere collassati in una struttura
     this.spritesheet = spritesheet;
     this.animation = new SpriteAnimation(frameSize, spritesheet, timePerFrame);
 }
コード例 #7
0
 public MainWindow()
 {
     InitializeComponent();
     _contentHandler     = new TextContentHandler();
     _graphCreator       = new GraphCreator();
     _huffmannEncodedMap = new ObservableCollection <DisplayData>();
     this.DataContext    = _huffmannEncodedMap;
 }
コード例 #8
0
ファイル: Sprite.cs プロジェクト: ezamagni/xebab
        public Sprite(IContentHandler contentHandler, List<Polygon> shapeSet)
        {
            this.contentHandler = contentHandler;
            this.shapeSet = shapeSet;

            behaviors = new List<IBehavior>();
            behaviorsToRemove = new Queue<IBehavior>();
        }
コード例 #9
0
ファイル: Scene.cs プロジェクト: ezamagni/xebab
 public Scene(Game game, SpriteBatch spriteBatch, Level level, 
     Camera camera/*, ResourceHandler resourceHandler*/)
     : base(game)
 {
     this.spriteBatch = spriteBatch;
     //TODO hack temporaneo con resourcehandler
     contentHandler = new ContentHandler(game.GraphicsDevice,
         spriteBatch, level, camera, new ResourceHandler(new System.Collections.Generic.List<Resource>()));
 }
コード例 #10
0
 /// <summary>
 ///   Constructs a SAX Parser.
 /// </summary>
 public SAXDriver()
 {
     _entityResolver = _base;
     _contentHandler = _base;
     _dtdHandler     = _base;
     _errorHandler   = _base;
     _declHandler    = _base;
     _lexicalHandler = _base;
 }
コード例 #11
0
        protected virtual void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = VEFModule.UnityContainer.Resolve(typeof(AbstractWorkspace), "") as AbstractWorkspace;
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler handler   = _dictionary[_availableNewContent[0]];
                var             openValue = handler.NewContent(_availableNewContent[0]);

                if (openValue == null)
                {
                    return;
                }

                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                //   throw new NotImplementedException();

                NewFileWindow window = new NewFileWindow();
                window.Owner = Application.Current.MainWindow;
                //  Brush backup = _statusBar.Background;
                //  _statusBar.Background = _newBackground;
                _statusBar.Text = "Select a new file";
                if (Application.Current.MainWindow is MetroWindow)
                {
                    window.Resources = Application.Current.MainWindow.Resources;
                    Window win = Application.Current.MainWindow as MetroWindow;
                    window.Resources = win.Resources;
                    //window.GlowBrush = win.GlowBrush;
                    //window.TitleForeground = win.TitleForeground;
                }
                window.DataContext = _availableNewContent;
                if (window.ShowDialog() == true)
                {
                    NewContentAttribute newContent = window.NewContent;
                    if (newContent != null)
                    {
                        IContentHandler handler   = _dictionary[newContent];
                        var             openValue = handler.NewContent(newContent);
                        if (openValue != null)
                        {
                            _workspace.Documents.Add(openValue);
                            _workspace.ActiveDocument = openValue;
                        }
                    }
                }
                // _statusBar.Background = new VEFBrush() { Brush = backup };
                _statusBar.Clear();
            }
        }
コード例 #12
0
        private void RegisterParts()
        {
            _container.RegisterType <MDHandler>();
            _container.RegisterType <MDViewModel>();
            _container.RegisterType <MDView>();

            IContentHandler handler = _container.Resolve <MDHandler>();

            _container.Resolve <IContentHandlerRegistry>().Register(handler);
        }
コード例 #13
0
ファイル: SmallXmlParser.cs プロジェクト: Chapmania/USVG
 private void Cleanup()
 {
     line    = 1;
     column  = 0;
     handler = null;
     reader  = null;
     elementNames.Clear();
     attributes.Clear();
     buffer.Length = 0;
 }
コード例 #14
0
 public static void SetHandler(MediaType contentType, IContentHandler handler)
 {
     if (handler != null)
     {
         _contentHandlers[contentType] = handler;
     }
     else
     {
         _contentHandlers.Remove(contentType);
     }
 }
コード例 #15
0
 public static void SetHandler(MediaType contentType, IContentHandler handler)
 {
     if (handler != null)
     {
         _contentHandlers[contentType] = handler;
     }
     else
     {
         _contentHandlers.Remove(contentType);
     }
 }
コード例 #16
0
        /// <summary>
        /// Unregisters a content handler
        /// </summary>
        /// <param name="handler">The handler to remove</param>
        /// <returns></returns>
        public bool Unregister(IContentHandler handler)
        {
            NewContentAttribute[] handlerAttributes = (NewContentAttribute[])(handler.GetType()).GetCustomAttributes(typeof(NewContentAttribute), true);
            _availableNewContent.RemoveAll(handlerAttributes.Contains);
            foreach (NewContentAttribute newContentAttribute in handlerAttributes)
            {
                _dictionary.Remove(newContentAttribute);
            }

            _availableNewContent.Sort((attribute, contentAttribute) => attribute.Priority - contentAttribute.Priority);
            return(ContentHandlers.Remove(handler));
        }
コード例 #17
0
ファイル: Indexer.cs プロジェクト: formist/LinkMe
        public Indexer(IBooster booster, IJobAdFlagListsQuery jobAdFlagListsQuery)
        {
            _contentAnalyzer = new SimpleAnalyzer();

            _contentHandler     = new ContentHandler();
            _salaryHandler      = new SalaryContentHandler(booster);
            _createdTimeHandler = new CreatedTimeContentHandler(booster);
            _integratorHandler  = new IntegratorContentHandler(booster);
            _jobTypesHandler    = new JobTypesContentHandler(booster);

            _jobAdFlagListsQuery = jobAdFlagListsQuery;
        }
コード例 #18
0
 private void Cleanup()
 {
     line    = 1;
     column  = 0;
     handler = null;
     reader  = null;
     elementNames.Clear();
     xmlSpaces.Clear();
     attributes.Clear();
     buffer.Length = 0;
     xmlSpace      = null;
     isWhitespace  = false;
 }
コード例 #19
0
        /// <summary>
        /// Register a content handler with the registry
        /// </summary>
        /// <param name="handler">The content handler</param>
        /// <returns>true, if successful - false, otherwise</returns>
        public bool Register(IContentHandler handler)
        {
            ContentHandlers.Add(handler);
            NewContentAttribute[] handlerAttributes = (NewContentAttribute[])(handler.GetType()).GetCustomAttributes(typeof(NewContentAttribute), true);
            _availableNewContent.AddRange(handlerAttributes);
            foreach (NewContentAttribute newContentAttribute in handlerAttributes)
            {
                _dictionary.Add(newContentAttribute, handler);
            }

            _availableNewContent.Sort((attribute, contentAttribute) => attribute.Priority - contentAttribute.Priority);
            return(true);
        }
コード例 #20
0
 private void Cleanup()
 {
     this.line    = 1;
     this.column  = 0;
     this.handler = null;
     this.reader  = null;
     this.elementNames.Clear();
     this.xmlSpaces.Clear();
     this.attributes.Clear();
     this.buffer.Length = 0;
     this.xmlSpace      = null;
     this.isWhitespace  = false;
 }
コード例 #21
0
 /// <summary>
 /// Returns a content view model for the specified object which needs to be displayed as a document
 /// The object could be anything - based on the handlers, a content view model is returned
 /// </summary>
 /// <param name="info">The object which needs to be displayed as a document in Wider</param>
 /// <returns>The content view model for the given info</returns>
 public ContentViewModel GetViewModel(Object info)
 {
     for (Int32 i = ContentHandlers.Count - 1; i >= 0; i--)
     {
         IContentHandler opener = ContentHandlers[i];
         if (opener.ValidateContentType(info))
         {
             ContentViewModel vm = opener.OpenContent(info);
             vm.Handler = opener;
             return(vm);
         }
     }
     return(null);
 }
コード例 #22
0
 /// <summary>
 /// Returns a content view model for the specified contentID which needs to be displayed as a document
 /// The contentID is the ID used in AvalonDock
 /// </summary>
 /// <param name="contentId">The contentID which needs to be displayed as a document in Wider</param>
 /// <returns>The content view model for the given info</returns>
 public ContentViewModel GetViewModelFromContentId(String contentId)
 {
     for (Int32 i = ContentHandlers.Count - 1; i >= 0; i--)
     {
         IContentHandler opener = ContentHandlers[i];
         if (opener.ValidateContentFromId(contentId))
         {
             ContentViewModel vm = opener.OpenContentFromId(contentId);
             vm.Handler = opener;
             return(vm);
         }
     }
     return(null);
 }
コード例 #23
0
        private void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = _container.Resolve <IWorkspace>();
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler  handler   = _dictionary[_availableNewContent[0]];
                ContentViewModel openValue = handler.NewContent(_availableNewContent[0]);
                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                INewFileWindow window = _container.Resolve <INewFileWindow>();
                if (window == null)
                {
                    return;
                }
                Brush backup = _statusBar.Background;
                _statusBar.Background = _newBackground;
                _statusBar.Text       = "Select a new file";
                //if (Application.Current.MainWindow is MetroWindow)
                //{
                //    window.Resources = Application.Current.MainWindow.Resources;
                //    Window win = Application.Current.MainWindow as MetroWindow;
                //    window.Resources = win.Resources;
                //    //window.GlowBrush = win.GlowBrush;
                //    //window.TitleForeground = win.TitleForeground;
                //}
                window.DataContext = _availableNewContent;
                if (window.ShowDialog() == true)
                {
                    NewContentAttribute newContent = window.NewContent;
                    if (newContent != null)
                    {
                        IContentHandler  handler   = _dictionary[newContent];
                        ContentViewModel openValue = handler.NewContent(newContent);
                        _workspace.Documents.Add(openValue);
                        _workspace.ActiveDocument = openValue;
                    }
                }
                _statusBar.Background = backup;
                _statusBar.Clear();
            }
        }
コード例 #24
0
 public void Parse(TextReader input, IContentHandler handler)
 {
     this.reader  = input;
     this.handler = handler;
     handler.OnStartParsing(this);
     while (this.Peek() >= 0)
     {
         this.ReadContent();
     }
     this.HandleBufferedContent();
     if (this.elementNames.Count > 0)
     {
         throw this.Error(string.Format("Insufficient close tag: {0}", this.elementNames.Peek()));
     }
     handler.OnEndParsing(this);
     this.Cleanup();
 }
コード例 #25
0
        private void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = _container.Resolve <DefaultWorkspace>();
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler handler   = _dictionary[_availableNewContent[0]];
                var             openValue = handler.NewContent(_availableNewContent[0]);
                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                //TODO : Make this overridable
                DefaultNewFileWindow window = new DefaultNewFileWindow();
                Brush backup = _statusBar.Background;
                _statusBar.Background = _newBackground;
                _statusBar.Text       = "Select a new file";
                if (System.Windows.Application.Current.MainWindow is MetroWindow)
                {
                    window.Resources = System.Windows.Application.Current.MainWindow.Resources;
                    Window win = System.Windows.Application.Current.MainWindow as MetroWindow;
                    window.Resources = win.Resources;
                    //window.GlowBrush = win.GlowBrush;
                    //window.TitleForeground = win.TitleForeground;
                }
                window.DataContext = _availableNewContent;
                if (window.ShowDialog() == true)
                {
                    NewContentAttribute newContent = window.NewContent;
                    if (newContent != null)
                    {
                        IContentHandler handler   = _dictionary[newContent];
                        var             openValue = handler.NewContent(newContent);
                        _workspace.Documents.Add(openValue);
                        _workspace.ActiveDocument = openValue;
                    }
                }
                _statusBar.Background = backup;
                _statusBar.Clear();
            }
        }
コード例 #26
0
ファイル: ContentCollector.cs プロジェクト: daviddw/Kinsky
        public ContentCollector(IContainer aContainer, IContentHandler aContentHandler)
        {
            iContentHandlerLock = new object();
            iContainer          = aContainer;
            iContentHandler     = aContentHandler;

            iStartIndex = -1;
            iCount      = -1;

            iExit  = false;
            iMutex = new Mutex(false);
            iEvent = new AutoResetEvent(false);

            iThread              = new Thread(Run);
            iThread.Name         = "ContentCollector";
            iThread.IsBackground = true;
            iThread.Start();
        }
コード例 #27
0
ファイル: SmallXmlParser.cs プロジェクト: midgithub/notes
        private void Cleanup()
        {
            line    = 1;
            column  = 0;
            handler = null;
            reader  = null;
#if CF_1_0
            elementNames = new Stack();
            xmlSpaces    = new Stack();
#else
            elementNames.Clear();
            xmlSpaces.Clear();
#endif
            attributes.Clear();
            buffer.Length = 0;
            xmlSpace      = null;
            isWhitespace  = false;
        }
コード例 #28
0
ファイル: Indexer.cs プロジェクト: formist/LinkMe
        public Indexer(Analyzer contentAnalyzer, Analyzer queryAnalyzer, IResourceSearchBooster booster, IResourcesQuery resourcesQuery, IFaqsQuery faqsQuery)
        {
            _contentAnalyzer = contentAnalyzer;
            _queryBuilder    = new QueryBuilder(queryAnalyzer);

            _contentHandler     = new ContentHandler(booster);
            _createdTimeHandler = new CreatedTimeContentHandler(booster);
            _subcategoryHandler = new SubcategoryContentHandler(booster, resourcesQuery, faqsQuery);
            _itemTypeHandler    = new ItemTypeContentHandler(booster);
            _popularityHandler  = new PopularityContentHandler(booster);

            _handlers = new[]
            {
                _itemTypeHandler,
                _subcategoryHandler,
                _createdTimeHandler,
                _popularityHandler
            };
        }
コード例 #29
0
ファイル: SmallXmlParser.cs プロジェクト: Chapmania/USVG
    public void Parse(TextReader input, IContentHandler handler)
    {
        this.reader  = input;
        this.handler = handler;

        handler.OnStartParsing(this);

        while (Peek() >= 0)
        {
            ReadContent();
        }
        buffer.Length = 0;
        if (elementNames.Count > 0)
        {
            throw Error(String.Format("Insufficient close tag: {0}", elementNames.Peek()));
        }

        Cleanup();
    }
コード例 #30
0
ファイル: CoreModule.cs プロジェクト: sispd/Wider
        public void OnInitialized(IContainerProvider newContainerProvider)
        {
            containerProvider = newContainerProvider;
            eventAggregator   = containerProvider.Resolve <IEventAggregator>();

            eventAggregator.GetEvent <SplashMessageUpdateEvent>()
            .Publish(new SplashMessageUpdateEvent {
                Message = "Loading Core Module"
            });

            IContentHandler handler = containerProvider.Resolve <MDHandler>();

            containerProvider.Resolve <IContentHandlerRegistry>().Register(handler);

            LoadTheme();
            LoadCommands();
            LoadMenus();
            LoadToolbar();
            LoadSettings();
        }
コード例 #31
0
        public static IContentHandler[] LoadContentHandlers(Assembly assembly, params object[] args)
        {
            Type[] types = LoadTypes(assembly, null, typeof(IContentHandler));
            List <IContentHandler> list = new List <IContentHandler>();

            if (types.Length < 1)
            {
                return(null);
            }
            for (int i = 0; i < types.Length; i++)
            {
                IContentHandler item = _typeToInstance(types[0], args) as IContentHandler;
                if (null != item)
                {
                    list.Add(item);
                }
            }

            IContentHandler[] array = new IContentHandler[list.Count];
            list.CopyTo(array);
            return(array);
        }
コード例 #32
0
        private Indexer(Analyzer contentAnalyzer, Analyzer queryAnalyzer, IMemberSearchBooster booster, ILocationQuery locationQuery, IIndustriesQuery industriesQuery, ICandidateFlagListsQuery candidateFlagListsQuery)
        {
            _contentAnalyzer = contentAnalyzer;
            _queryAnalyzer   = queryAnalyzer;
            _queryBuilder    = new QueryBuilder(_queryAnalyzer, booster);

            _contentHandler         = new ContentHandler();
            _locationHandler        = new LocationContentHandler(booster, locationQuery);
            _industryHandler        = new IndustryContentHandler(booster, industriesQuery);
            _nameHandler            = new NameContentHandler(contentAnalyzer, booster);
            _desiredJobTypesHandler = new DesiredJobTypesContentHandler(booster);
            _candidateStatusHandler = new CandidateStatusContentHandler(booster);
            _ethnicStatusHandler    = new EthnicStatusContentHandler(booster);
            _visaStatusHandler      = new VisaStatusContentHandler(booster);
            _communityHandler       = new CommunityContentHandler(booster);
            _salaryHandler          = new SalaryContentHandler(booster);
            _lastUpdatedHandler     = new LastUpdatedContentHandler(booster);
            _hasResumeHandler       = new HasResumeContentHandler();
            _isActivatedHandler     = new IsActivatedContentHandler();
            _isContactableHandler   = new IsContactableContentHandler();

            _handlers = new[]
            {
                _desiredJobTypesHandler,
                _candidateStatusHandler,
                _ethnicStatusHandler,
                _visaStatusHandler,
                _industryHandler,
                _communityHandler,
                _salaryHandler,
                _lastUpdatedHandler,
                _locationHandler,
                _hasResumeHandler,
                _isActivatedHandler,
                _isContactableHandler
            };

            _candidateFlagListsQuery = candidateFlagListsQuery;
        }
コード例 #33
0
ファイル: SmallXmlParser.cs プロジェクト: grrava/UnitySVG
 private void Cleanup()
 {
     line = 1;
     column = 0;
     handler = null;
     reader = null;
     elementNames.Clear();
     attributes.Clear();
     buffer.Length = 0;
 }
コード例 #34
0
ファイル: ContentHandlerRegistry.cs プロジェクト: vinodj/Wide
 public bool Unregister(IContentHandler handler)
 {
     return _contentHandlers.Remove(handler);
 }
コード例 #35
0
ファイル: ContentHandlerRegistry.cs プロジェクト: vinodj/Wide
 public bool Register(IContentHandler handler)
 {
     _contentHandlers.Add(handler);
     return true;
 }
コード例 #36
0
 public void SetContentHandler(IContentHandler contentHandler)
 {
     _contentHandler = null;
 }
コード例 #37
0
ファイル: MDViewModel.cs プロジェクト: ruisebastiao/Wide
 internal void SetHandler(IContentHandler handler)
 {
     base.Handler = handler;
 }
コード例 #38
0
        public void Parse(TextReader input, IContentHandler handler)
        {
            this.reader = input;
            this.handler = handler;

            handler.OnStartParsing(this);

            while (Peek() >= 0)
            {
                ReadContent();
            }

            HandleBufferedContent();
            if (elementNames.Count > 0)
                throw Error(String.Format("Insufficient close tag: {0}", elementNames.Peek()));

            handler.OnEndParsing(this);

            Cleanup();
        }
コード例 #39
0
 private void Cleanup()
 {
     line = 1;
     column = 0;
     handler = null;
     reader = null;
     #if CF_1_0
     elementNames = new Stack ();
     xmlSpaces = new Stack ();
     #else
     elementNames.Clear();
     xmlSpaces.Clear();
     #endif
     attributes.Clear();
     buffer.Length = 0;
     xmlSpace = null;
     isWhitespace = false;
 }
コード例 #40
0
        internal void startElement(string elname)
        {
            IContentHandler handler = contentHandler;

            string localName = string.Empty;
            string ns        = string.Empty;

            if (!attributes)
            {
            }
            else if (namespaces)
            {
                // now we can patch up namespace refs; we saw all the
                // declarations, so now we'll do the Right Thing
                for (int i = 0; i < attributeCount; i++)
                {
                    AttributeData att = attributeData[i];

                    // NS prefix declaration?
                    if (att.Declaration && !xmlNames)
                    {
                        continue;
                    }

                    // it's not a NS decl; patch namespace info items
                    processAttribute(att.QName, out localName, out ns);
                    att.Uri       = ns;
                    att.LocalName = localName;

                    for (int j = 0; j < i; j++)
                    {
                        if (att.Uri == attributeData[j].Uri &&
                            att.LocalName == attributeData[j].LocalName)
                        {
                            if (att.Uri != null && att.Uri != "")
                            {
                                fatal("duplicate attribute {" + att.Uri + "}" + att.LocalName);
                            }
                            else
                            {
                                fatal("duplicate attribute \"" + att.LocalName + "\"");
                            }
                        }
                    }
                }
            }

            // save element name so attribute callbacks work
            elementName = elname;
            if (namespaces)
            {
                processElement(elname, out localName, out ns);
                handler.StartElement(ns, localName, elname, this);
            }
            else
            {
                handler.StartElement("", "", elname, this);
            }

            // elements with no attributes are pretty common!
            if (attributes)
            {
                attributeCount = 0;
                attributes     = false;
            }
        }
コード例 #41
0
        /// <summary>
        /// Unregisters a content handler
        /// </summary>
        /// <param name="handler">The handler to remove</param>
        /// <returns></returns>
        public bool Unregister(IContentHandler handler)
        {
            NewContentAttribute[] handlerAttributes = (NewContentAttribute[])(handler.GetType()).GetCustomAttributes(typeof(NewContentAttribute), true);
            _availableNewContent.RemoveAll(handlerAttributes.Contains);
            foreach (NewContentAttribute newContentAttribute in handlerAttributes)
            {
                _dictionary.Remove(newContentAttribute);
            }

            _availableNewContent.Sort((attribute, contentAttribute) => attribute.Priority - contentAttribute.Priority);
            return ContentHandlers.Remove(handler);
        }
        private void Dispatch <TParam1, TParam2, TParam3>(TPayloadBase payload, string contentType, string handlerClass, TParam1 param1, TParam2 param2, TParam3 param3)
        {
            IContentHandler <TPayloadBase, TParam1, TParam2, TParam3> handler = this.serviceProvider.GetRequiredContent <IContentHandler <TPayloadBase, TParam1, TParam2, TParam3> >(ContentHandlerUtilities.GetHandlerContentType(contentType, handlerClass));

            handler.Handle(payload, param1, param2, param3);
        }
コード例 #43
0
ファイル: SAXDriver.cs プロジェクト: rasmusjp/aelfred.net
 /// <summary>
 ///   Constructs a SAX Parser.
 /// </summary>
 public SAXDriver() {
   _entityResolver = _base;
   _contentHandler = _base;
   _dtdHandler = _base;
   _errorHandler = _base;
   _declHandler = _base;
   _lexicalHandler = _base;
 }
コード例 #44
0
 public void SetContentHandler(IContentHandler contentHandler) {
 	_contentHandler = null;
 }
コード例 #45
0
ファイル: Helper.cs プロジェクト: amartelr/Beetle.js
        public static ProcessResult DefaultRequestProcessor(object contentValue, IEnumerable<KeyValuePair<string, string>> beetlePrms, ActionContext actionContext,
                                                            IBeetleService service, IContextHandler contextHandler,
                                                            IQueryHandler<IQueryable> queryableHandler, IContentHandler<IEnumerable> enumerableHandler) {
            var queryable = contentValue as IQueryable;
            if (queryable != null)
                return queryableHandler.HandleContent(queryable, beetlePrms, actionContext, service, contextHandler);

            if (!(contentValue is string)) {
                var enumerable = contentValue as IEnumerable;
                if (enumerable != null)
                    return enumerableHandler.HandleContent(enumerable, beetlePrms, actionContext, service, contextHandler);
            }

            return new ProcessResult(actionContext) { Result = contentValue };
        }
コード例 #46
0
 private void Cleanup()
 {
     line = 1;
     column = 0;
     handler = null;
     reader = null;
     elementNames.Clear();
     xmlSpaces.Clear();
     attributes.Clear();
     buffer.Length = 0;
     xmlSpace = null;
     isWhitespace = false;
 }
コード例 #47
0
ファイル: Parser.cs プロジェクト: rasmusjp/tagsoup.net
 /// <summary>
 ///   Creates a new instance of <see cref="Parser" />
 /// </summary>
 public Parser() {
   _newElement = null;
   _contentHandler = this;
   _lexicalHandler = this;
   _dtdHandler = this;
   _errorHandler = this;
   _entityResolver = this;
 }
コード例 #48
0
        /// <summary>
        /// Register a content handler with the registry
        /// </summary>
        /// <param name="handler">The content handler</param>
        /// <returns>true, if successful - false, otherwise</returns>
        public bool Register(IContentHandler handler)
        {
            ContentHandlers.Add(handler);
            NewContentAttribute[] handlerAttributes = (NewContentAttribute[])(handler.GetType()).GetCustomAttributes(typeof(NewContentAttribute), true);
            _availableNewContent.AddRange(handlerAttributes);
            foreach (NewContentAttribute newContentAttribute in handlerAttributes)
            {
                _dictionary.Add(newContentAttribute, handler);
            }

            _availableNewContent.Sort((attribute, contentAttribute) => attribute.Priority - contentAttribute.Priority);
            return true;
        }