Ejemplo n.º 1
0
        public object ModelBinder3()
        {
            ModelPropertyBinder child = null, mainBinder = null;
            ModelPropertyBinder binder = mainBinder = new ModelPropertyBinder();
            binder.SetDocument(new DomDocument(_sampleHtml));

            binder = binder.AddChildBinder(null, typeof(ModelPropertyBinderAction), "#_container");

            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div#_MiddleMain");
            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div.container_24");
            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div");
            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div#_Middle1_2.news-detail-content.turkiye-br");
            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "#news-content-contain");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div.content-area");
            child.AddChildBinder("title", typeof(HtmlPropertyBinderAction), "h1");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div.content-area");
            child.AddChildBinder("summary", typeof(HtmlPropertyBinderAction), "h5");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div#metin2");
            child = child.AddChildBinder("contentList", typeof(CollectionPropertyBinderAction), "p");
            child = child.AddChildBinder("", typeof(ModelPropertyBinderAction), "");
            child.AddChildBinder("content", typeof(HtmlPropertyBinderAction), "");

            mainBinder.Execute();

            return mainBinder.Model;
        }
Ejemplo n.º 2
0
        public object ModelBinder4()
        {
            ModelPropertyBinder child = null, mainBinder = null;
            ModelPropertyBinder binder = mainBinder = new ModelPropertyBinder();
            binder.SetDocument(new DomDocument(_sampleHtml));

            binder = binder.AddChildBinder(null, typeof(ModelPropertyBinderAction), "#news-content-contain");

            child = binder.AddChildBinder("contentList", typeof(CollectionPropertyBinderAction), "div#metin2 p");
            child = child.AddChildBinder("", typeof(CollectionPropertyBinderAction), "strong");
            child = child.AddChildBinder("", typeof(ModelPropertyBinderAction), "");
            child.AddChildBinder("content", typeof(HtmlPropertyBinderAction), "");

            mainBinder.Execute();

            return mainBinder.Model;
        }
Ejemplo n.º 3
0
        public object ModelBinder2()
        {
            ModelPropertyBinder child = null;
            ModelPropertyBinder mainBinder = new ModelPropertyBinder();
            mainBinder.SetDocument(new DomDocument(_sampleHtml));

            ModelPropertyBinder binder = mainBinder.AddChildBinder(null, typeof(ModelPropertyBinderAction), "#news-content-contain");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div.content-area");
            child.AddChildBinder("title", typeof(HtmlPropertyBinderAction), "h1");
            child.AddChildBinder("summary", typeof(HtmlPropertyBinderAction), "h5");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div#metin2");
            child = child.AddChildBinder("contentList", typeof(CollectionPropertyBinderAction), "p");
            child = child.AddChildBinder("", typeof(ModelPropertyBinderAction), "");
            child.AddChildBinder("content", typeof(HtmlPropertyBinderAction), "");

            mainBinder.Execute();

            return binder.Model;
        }