Esempio n. 1
0
 public static SimplTypesScope ComposeTranslations(Type[] newTranslations,
                                                   int portNumber, IPAddress ipAddress, SimplTypesScope requestTranslationSpace,
                                                   String prefix = "server_base: ")
 {
     return(SimplTypesScope.Get(prefix + ipAddress + ":" + portNumber, requestTranslationSpace,
                                newTranslations));
 }
Esempio n. 2
0
        public void RssTestJson()
        {
            SimplTypesScope simplTypesScope = SimplTypesScope.Get("rss", typeof(Rss),
                                                                  typeof(Channel),
                                                                  typeof(Item));


            List <String> categorySet = new List <String> {
                "cate\\dgory1", "category2"
            };

            Item item1 = new Item("testItem1", "testItem1Description", new ParsedUri("http://www.google.com"), "asdf",
                                  "nabeel", categorySet);
            Item item2 = new Item("testItem2", "testItem2Description", new ParsedUri("http://www.google.com"), "asdf",
                                  "nabeel", categorySet);

            Channel c = new Channel("testTile", "testDesc", new ParsedUri("http://www.google.com"),
                                    new List <Item> {
                item1, item2
            });

            Rss rss = new Rss(1.4f, c);


            TestMethods.TestSimplObject(rss, simplTypesScope, Format.Json);
        }
Esempio n. 3
0
//        [TestMethod]
        public void CircleTlv()
        {
            Circle          c = new Circle(new Point(1, 3), 3);
            SimplTypesScope circleTransaltionScope = SimplTypesScope.Get("circleTScope", typeof(Circle),
                                                                         typeof(Point));

            TestMethods.TestSimplObject(c, circleTransaltionScope, Format.Tlv);
        }
Esempio n. 4
0
//	    [TestMethod]
        public void TestAdvGenerics1()//ported from simplTranslators/test ecologylab.translators.java.generics.JavaTranslatorGenericTest.java
        {
            SimplTypesScope.EnableGraphSerialization();

            SimplTypesScope scope = SimplTypesScope.Get("test-adv-generics-1", typeof(SearchResult), typeof(Search <>), typeof(SocialSearchResult), typeof(SocialSearch), typeof(TypedSocialSearch <>));

            SimplTypesScope.DisableGraphSerialization();
        }
Esempio n. 5
0
        public void MapsWithinMapsTestJson()
        {
            TranslationS    test   = MapsWithinMaps.CreateObject();
            SimplTypesScope tScope = SimplTypesScope.Get("testScope", typeof(TranslationS),
                                                         typeof(ClassDes),
                                                         typeof(FieldDes));

            TestMethods.TestSimplObject(test, tScope, Format.Json);
        }
Esempio n. 6
0
        public void CompositeSubOneXml()
        {
            Container       c = new Container(new WcSubOne("testing", 1));
            SimplTypesScope simplTypesScope = SimplTypesScope.Get("compositeTScope", typeof(Container),
                                                                  typeof(WcBase), typeof(WcSubOne),
                                                                  typeof(WcSubTwo));

            TestMethods.TestSimplObject(c, simplTypesScope);
        }
Esempio n. 7
0
        public void CompositeSubTwoJson()
        {
            Container       c = new Container(new WcSubTwo(true, 1));
            SimplTypesScope simplTypesScope = SimplTypesScope.Get("compositeTScope", typeof(Container),
                                                                  typeof(WcBase), typeof(WcSubOne),
                                                                  typeof(WcSubTwo));

            TestMethods.TestSimplObject(c, simplTypesScope, Format.Json);
        }
        public void ContainingClassCc1Json()
        {
            SimplTypesScope translationScope = SimplTypesScope.Get("test", typeof(ContainingClass),
                                                                   typeof(ChildClass1), typeof(ChildClass2),
                                                                   typeof(BaseClass));
            ContainingClass cc1 = new ContainingClass {
                TheField = new ChildClass1()
            };

            TestMethods.TestSimplObject(cc1, translationScope, Format.Json);
        }
Esempio n. 9
0
//        [TestMethod]
        public void ContainerJson()
        {
            SimplTypesScope.EnableGraphSerialization();

            Container       test             = new Container().InitializeInstance();
            SimplTypesScope translationScope = SimplTypesScope.Get("testcollection", typeof(Container),
                                                                   typeof(ClassA));

            TestMethods.TestSimplObject(test, translationScope, Format.Json);


            SimplTypesScope.DisableGraphSerialization();
        }
Esempio n. 10
0
//        [TestMethod]
        public void ClassDJson()
        {
            SimplTypesScope.EnableGraphSerialization();

            ClassC classC = new ClassC();
            ClassD test   = new ClassD(new ClassA(classC), new ClassB(classC));

            SimplTypesScope tScope = SimplTypesScope.Get("classD", typeof(ClassA), typeof(ClassB),
                                                         typeof(ClassC), typeof(ClassD), typeof(ClassX));

            TestMethods.TestSimplObject(test, tScope, Format.Json);

            SimplTypesScope.DisableGraphSerialization();
        }
        public static SimplTypesScope Get()
        {
            SimplTypesScope semanticActionScope = SemanticOperationTranslationScope.Get();
            SimplTypesScope conditionScope      = SimplTypesScope.Get("condition_scope", conditionClasses);
            SimplTypesScope nestedFieldTypes    = NestedMetaMetadataFieldTypesScope.Get();
            SimplTypesScope mmdScope            = SimplTypesScope.Get("meta_metadata", MetaMetadataFieldTranslationScope.Get(),
                                                                      translations);

            mmdScope.AddTranslations(semanticActionScope);
            mmdScope.AddTranslations(conditionScope);
            mmdScope.AddTranslations(nestedFieldTypes);

            return(mmdScope);
        }
Esempio n. 12
0
        //        [TestMethod]
        public void ClassBJson()
        {
            SimplTypesScope.EnableGraphSerialization();

            ClassA test   = new ClassA(1, 2);
            ClassB classB = new ClassB(3, 4, test);

            test.ClassB = classB;

            SimplTypesScope tScope = SimplTypesScope.Get("classA", typeof(ClassA), typeof(ClassB));

            TestMethods.TestSimplObject(test, tScope, Format.Json);

            SimplTypesScope.DisableGraphSerialization();
        }
Esempio n. 13
0
        public void ClassBXml()
        {
            SimplTypesScope.EnableGraphSerialization();

            ClassB test   = new ClassB(1, 2);
            ClassA classA = new ClassA(3, 4, test);

            test.ClassA = classA;

            SimplTypesScope tScope = SimplTypesScope.Get("classB", typeof(ClassA), typeof(ClassB));

            TestMethods.TestSimplObject(test, tScope, Format.Xml);

            SimplTypesScope.DisableGraphSerialization();
        }
        public void ScalarCollectionJson()
        {
            ScalarCollection sc = new ScalarCollection();

            sc.AddInt(2);
            sc.AddInt(3);
            sc.AddInt(4);
            sc.AddInt(5);
            sc.AddInt(6);
            sc.AddInt(7);

            SimplTypesScope scalarCollectionSimplTypesScope = SimplTypesScope.Get(
                "scalarCollectionTScope", typeof(ScalarCollection));

            TestMethods.TestSimplObject(sc, scalarCollectionSimplTypesScope, Format.Json);
        }
Esempio n. 15
0
        public void SimplCompositeTagReprIsFieldName()
        {
            var testObj = new InternalCompositeTestClass(5);

            SimplTypesScope sTs = SimplTypesScope.Get("compTestScope", typeof(InternalCompositeTestClass), typeof(InternalTestClass));

            TestMethods.TestSimplObject(testObj, sTs);

            var resultStream = TestMethods.TestSerialization(testObj, Format.Xml);

            string xmlString = resultStream.StringData;

            XElement xe = XElement.Parse(xmlString);

            Assert.IsTrue(xe.Elements("internal_composite").Any(), "Should have an XML composite element \"internal_composite\"");
        }
Esempio n. 16
0
        public void ConfigurationJson()
        {
            PrefInteger prefInteger = new PrefInteger("integer_pref", 2);
            PrefDouble  prefDouble  = new PrefDouble("integer_pref", 4);

            Pref pref = new Pref("only_pref");

            List <Pref> prefList = new List <Pref> {
                pref, prefInteger, prefDouble
            };

            Configuration   c = new Configuration(prefInteger, prefList);
            SimplTypesScope simplTypesScope = SimplTypesScope.Get("configuration", typeof(Configuration),
                                                                  typeof(PrefInteger), typeof(PrefDouble), typeof(Pref));

            TestMethods.TestSimplObject(c, simplTypesScope, Format.Json);
        }
Esempio n. 17
0
        public void StudentDirectoryTestJson()
        {
            List <Student> students = new List <Student>
            {
                new Student("nabeel", "234342"),
                new Student("yin", "3423423"),
                new Student("bill", "4234"),
                new Student("sashi", "545454"),
                new Student("jon", "53453453")
            };
            StudentDirectory p = new StudentDirectory(students);

            SimplTypesScope simplTypesScope = SimplTypesScope.Get("studentDir", typeof(Person),
                                                                  typeof(Student), typeof(StudentDirectory));

            TestMethods.TestSimplObject(p, simplTypesScope, Format.Json);
        }
Esempio n. 18
0
        public void PersonDirectoryTestJson()
        {
            List <Person> persons = new List <Person>
            {
                new Student("nabeel", "234342"),
                new Student("yin", "3423423"),
                new Faculty("andruid", "professor"),
                new Student("bill", "4234"),
                new Student("sashi", "545454"),
                new Student("jon", "53453453")
            };
            PersonDirectory p = new PersonDirectory(persons);

            SimplTypesScope simplTypesScope = SimplTypesScope.Get("personDir", typeof(Person),
                                                                  typeof(Faculty), typeof(Student), typeof(PersonDirectory));

            TestMethods.TestSimplObject(p, simplTypesScope, Format.Json);
        }
Esempio n. 19
0
        public void ItemContainerJson()
        {
            Container c = new Container();
            c.PopulateContainer();

            SimplTypesScope.Get("itemScope1", typeof(Container), typeof(ItemBase),
                                typeof(ItemOne), typeof(ItemTwo));

            SimplTypesScope.Get("itemScope2", typeof(Container), typeof(ItemBase),
                                typeof(ItemTwo), typeof(ItemRandom));

            SimplTypesScope containerTranslationScope = SimplTypesScope.Get("containerScope",
                                                                            typeof(Container), typeof(ItemBase),
                                                                            typeof(ItemOne), typeof(ItemTwo),
                                                                            typeof(ItemRandom));

            TestMethods.TestSimplObject(c, containerTranslationScope, Format.Json);
        }
Esempio n. 20
0
        public void SimplScalarTagReprIsFieldName()
        {
            var testObj = new InternalTestClass();

            testObj.ourScalar = 3;

            SimplTypesScope sTs = SimplTypesScope.Get("scalarTestScope", typeof(InternalTestClass));

            TestMethods.TestSimplObject(testObj, sTs);

            var resultStream = TestMethods.TestSerialization(testObj, Format.Xml);

            string xmlString = resultStream.StringData;

            XElement xe = XElement.Parse(xmlString);

            Assert.IsTrue(xe.Attributes("our_scalar").Any(), "Should have an XML scalar attribute \"our_scalar\"");
            Assert.IsTrue(int.Parse(xe.Attribute("our_scalar").Value.ToString()) == 3, "Our scalar value should be equal to 3!");
        }
Esempio n. 21
0
        public MetadataServicesClient(SimplTypesScope metadatascope, SemanticsSessionScope semanticSessionScope, ParsedUri serviceUri, bool useWebSockets = false)
        {
            SimplTypesScope[] oodssAndMetadataScope = { metadatascope, DefaultServicesTranslations.Get() };

            _metadataTypeScope = SimplTypesScope.Get("MetadataServicesTranslationScope",
                                                     oodssAndMetadataScope,
                                                     typeof(MetadataRequest),
                                                     typeof(MetadataResponse),
                                                     typeof(SemanticServiceError)
                                                     );

            _serviceBaseUri = serviceUri;

            if (useWebSockets)
            {
                _metadataClient = new WebSocketOODSSClient("127.0.0.1", 2018, _metadataTypeScope, semanticSessionScope);
                _metadataClient.StartAsync();
            }
        }
        public new MetadataClassDescriptor BindMetadataClassDescriptor(SimplTypesScope metadataTScope)
        {
            if (metadataClassDescriptor != null)
            {
                return(metadataClassDescriptor);
            }

            // create a temporary local metadata translation scope
            SimplTypesScope localMetadataTScope = SimplTypesScope.Get("mmd_local_tscope:" + Name, metadataTScope);

            // record the initial number of classes in the local translation scope

            int initialLocalTScopeSize = localMetadataTScope.EntriesByClassName.Count;

            // do actual stuff ...
            base.BindMetadataClassDescriptor(localMetadataTScope);

            // if tag overlaps, or there are fields using classes not in metadataTScope, use localTScope
            MetadataClassDescriptor thisCd = this.MetadataClassDescriptor;

            if (thisCd != null)
            {
                MetadataClassDescriptor thatCd = (MetadataClassDescriptor)metadataTScope.GetClassDescriptorByTag(thisCd.TagName);
                if (thisCd != thatCd)
                {
                    localMetadataTScope.AddTranslation(thisCd);
                    this.localMetadataTranslationScope = localMetadataTScope;
                }
                else if (localMetadataTScope.EntriesByClassName.Count > initialLocalTScopeSize)
                {
                    this.localMetadataTranslationScope = localMetadataTScope;
                }
                else
                {
                    this.localMetadataTranslationScope = metadataTScope;
                }
            }

            // return the bound metadata class descriptor
            return(thisCd);
        }
Esempio n. 23
0
 public static SimplTypesScope Get()
 {
     return(SimplTypesScope.Get("repository_builtin_declarations_scope",
                                typeof(AggregateMediaDeclaration),
                                typeof(AggregateSelfmadeDeclaration),
                                typeof(AnnotateDeclaration),
                                typeof(AssignPrimaryLinkDeclaration),
                                typeof(AudioDeclaration),
                                typeof(AuthorDeclaration),
                                typeof(BirthDetailDeclaration),
                                typeof(ClippableDocumentDeclaration),
                                typeof(ClippingDeclaration <>),
                                typeof(CommentDeclaration),
                                typeof(ContactPointDeclaration),
                                typeof(CreativeActDeclaration),
                                typeof(CreativeWorkDeclaration),
                                typeof(CurateLinkDeclaration),
                                typeof(CurationDeclaration),
                                typeof(DebugMetadataDeclaration),
                                typeof(DocumentDeclaration),
                                typeof(DocumentMetadataWrapDeclaration),
                                typeof(FrameSelfmadeDeclaration),
                                typeof(GisLocationDeclaration),
                                typeof(HtmlTextDeclaration),
                                typeof(IdeaMacheUserDeclaration),
                                typeof(ImageClippingDeclaration),
                                typeof(ImageDeclaration),
                                typeof(ImageSelfmadeDeclaration),
                                typeof(MetadataDeclaration),
                                typeof(PersistenceMetaInfoDeclaration),
                                typeof(PersonDeclaration),
                                typeof(PresentationFrameDeclaration),
                                typeof(RatingDeclaration),
                                typeof(RichArtifactDeclaration <>),
                                typeof(RichDocumentDeclaration),
                                typeof(SequencedClippableDocumentDeclaration),
                                typeof(TextClippingDeclaration),
                                typeof(TextSelfmadeDeclaration),
                                typeof(VideoDeclaration)));
 }
Esempio n. 24
0
        public void TestSemanticServiceError()
        {
            SimplTypesScope repositoryMetadataTranslationScope = RepositoryMetadataTranslationScope.Get();

            SimplTypesScope typesScope = SimplTypesScope.Get("MetadataServicesTranslationScope",
                                                             repositoryMetadataTranslationScope,
                                                             typeof(MetadataRequest),
                                                             typeof(MetadataResponse),
                                                             typeof(SemanticServiceError));
            String response = "<semantic_service_error code=\"2001\" error_message=\"Error\" />";

            ServiceMessage serviceMessage = (ServiceMessage)typesScope.Deserialize(response, StringFormat.Xml);

            try
            {
                (serviceMessage as SemanticServiceError).Perform();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.WriteLine(SimplTypesScope.Serialize(serviceMessage, StringFormat.Xml));
        }
Esempio n. 25
0
 public static SimplTypesScope Get()
 {
     return(SimplTypesScope.Get(Name, InheritedScopes, Translations));
 }
 public static SimplTypesScope Get()
 {
     return(SimplTypesScope.Get("repository_metadata", MetadataBuiltinsTypesScope.Get(),
                                typeof(AcmPortal),
                                typeof(AcmPortalAuthor),
                                typeof(AcmPortalAuthorCollaborators),
                                typeof(AcmPortalAuthorPublicationDetail),
                                typeof(AcmPortalInstitutionProfile),
                                typeof(AcmPortalPeriodical),
                                typeof(AcmPortalSearch),
                                typeof(AcmPortalSearchResult),
                                typeof(Actor),
                                typeof(AdditionalMetadata),
                                typeof(AmazonBook),
                                typeof(AmazonList),
                                typeof(AmazonProduct),
                                typeof(Artist),
                                typeof(Artwork),
                                typeof(Audience),
                                typeof(Author),
                                typeof(BasicPublication),
                                typeof(BingSearchApi),
                                typeof(BirthDetail),
                                typeof(Blog),
                                typeof(Body),
                                typeof(Book),
                                typeof(Bookmark),
                                typeof(BritishCartoonArchive),
                                typeof(CameraSettings),
                                typeof(Cartoon),
                                typeof(CategoryInterviews),
                                typeof(Channel),
                                typeof(CitationInfo),
                                typeof(CiteseerxCiting),
                                typeof(CiteseerxRecord),
                                typeof(CiteseerxSearch),
                                typeof(CiteseerxSimilar),
                                typeof(CiteseerxSummary),
                                typeof(CiteulikeAuthor),
                                typeof(CiteulikePaper),
                                typeof(CiteulikeSearch),
                                typeof(CiteulikeTag),
                                typeof(CiteulikeUser),
                                typeof(Collection),
                                typeof(Comment),
                                typeof(Commodity),
                                typeof(ContactPoint),
                                typeof(Contributor),
                                typeof(CreativeWork),
                                typeof(DateInfo),
                                typeof(Dc),
                                typeof(DcDocument),
                                typeof(DeliciousHomepage),
                                typeof(DeliciousSearch),
                                typeof(DleseGetRecord),
                                typeof(DleseRecord),
                                typeof(DleseRecord1),
                                typeof(DleseRecord2),
                                typeof(DleseRecordHead),
                                typeof(DleseUserSearch),
                                typeof(Dlms),
                                typeof(DocumentSet),
                                typeof(Educational),
                                typeof(EmergentEvent),
                                typeof(EmergentEventCollection),
                                typeof(FastflipSearch),
                                typeof(FlickrAuthor),
                                typeof(FlickrPhoto),
                                typeof(FlickrTag),
                                typeof(GaurdianComic),
                                typeof(General),
                                typeof(GetRecordAdditionalMetadata),
                                typeof(GisLocation),
                                typeof(GlobeCartoon),
                                typeof(GoogleBook),
                                typeof(GooglePatent),
                                typeof(GooglePatentAuthor),
                                typeof(GoogleScholarSearch),
                                typeof(GoogleScholarSearchResult),
                                typeof(GoogleSorry),
                                typeof(GoogleTrends),
                                typeof(Grant),
                                typeof(GrantProgram),
                                typeof(GrantStaff),
                                typeof(Head),
                                typeof(Head1),
                                typeof(Head2),
                                typeof(Header),
                                typeof(HotSearch),
                                typeof(Hotel),
                                typeof(IcdlBook),
                                typeof(IcdlBookPreview),
                                typeof(IcdlImage),
                                typeof(IcdlImageResult),
                                typeof(IeeeXploreArticle),
                                typeof(IeeeXploreCitations),
                                typeof(IeeeXploreReferences),
                                typeof(IeeeXploreSearch),
                                typeof(ImageSearch),
                                typeof(ImageSearchResult),
                                typeof(InformaWorld),
                                typeof(Investigator <>),
                                typeof(Item),
                                typeof(ItemRecord),
                                typeof(KeywordSet),
                                typeof(Lifecycle),
                                typeof(Lolz),
                                typeof(MediaContent),
                                typeof(MmArtwork),
                                typeof(MobileRichBookmark),
                                typeof(MobileRichBookmarkCollection),
                                typeof(MomaArtwork),
                                typeof(Movie),
                                typeof(Nsdl),
                                typeof(NsdlDocument),
                                typeof(NsdlService),
                                typeof(NsfAward),
                                typeof(NsfDivision),
                                typeof(NsfDivisionStaffList),
                                typeof(NsfInvestigator),
                                typeof(NsfProgram),
                                typeof(NsfProgramStaffList),
                                typeof(NsfSearch),
                                typeof(NsfStaff),
                                typeof(Opml),
                                typeof(Organization),
                                typeof(Outline),
                                typeof(Page),
                                typeof(Paragraph),
                                typeof(Patent),
                                typeof(PatentAuthor),
                                typeof(PatentClassification),
                                typeof(PdfMixin),
                                typeof(Periodical),
                                typeof(Person),
                                typeof(PersonnelInterview),
                                typeof(Photostream),
                                typeof(PoliticalCartoon),
                                typeof(Post),
                                typeof(PostalAddress),
                                typeof(Product),
                                typeof(Publication),
                                typeof(Publisher),
                                typeof(PubmedArticle),
                                typeof(PubmedAuthor),
                                typeof(PubmedJournal),
                                typeof(Rating),
                                typeof(RecordMetaMetadata),
                                typeof(RecordMetadata),
                                typeof(RedditSearchResults),
                                typeof(Restaurant),
                                typeof(RestaurantGenre),
                                typeof(ResultInfo),
                                typeof(Review),
                                typeof(Rss),
                                typeof(Rss22),
                                typeof(ScholarlyArticle),
                                typeof(ScienceDirectArticle),
                                typeof(ScopusArticle),
                                typeof(ScopusAuthor),
                                typeof(ScopusSearch),
                                typeof(Search <>),
                                typeof(SearchAdditionalMetadataAdn),
                                typeof(SearchCrumb),
                                typeof(SearchMeta),
                                typeof(SearchResults),
                                typeof(SearchSection),
                                typeof(Section),
                                typeof(Service),
                                typeof(SfuCartoonArchive),
                                typeof(SlashdotArticle),
                                typeof(SlashdotItem),
                                typeof(SlashdotRss),
                                typeof(SlashdotSearch),
                                typeof(SocialMediaSearch1),
                                typeof(SocialMediaSearch2 <>),
                                typeof(SocialMediaSearchResult),
                                typeof(Spotrep),
                                typeof(Subject),
                                typeof(TempFieldValueHolder),
                                typeof(TermType),
                                typeof(Thumbnail),
                                typeof(Topic),
                                typeof(TopicCluster),
                                typeof(TribunalVoices),
                                typeof(TrumanLibrary1948CampaignCartoons),
                                typeof(Tumblr),
                                typeof(TumblrSearch),
                                typeof(TvShow),
                                typeof(TvShowEpisode),
                                typeof(UrbanSpoonSearch),
                                typeof(UserSearchAdditionalMetadata),
                                typeof(UvaModel),
                                typeof(Video),
                                typeof(VideoInterview),
                                typeof(WeatherReport),
                                typeof(WikipediaCategoryType),
                                typeof(WikipediaMobilePage),
                                typeof(WikipediaPage),
                                typeof(WikipediaPageType),
                                typeof(YahooGeoCode),
                                typeof(YahooGeoCodeResult),
                                typeof(YahooMediaRss),
                                typeof(YahooResult),
                                typeof(YahooResultSet),
                                typeof(YahooThumbnail),
                                typeof(YoutubeSearchResults)));
 }
Esempio n. 27
0
        public void RealRssXml()
        {
            /*
             * Read in RSS feed from URL
             */
            const string url            = "http://rss.cnn.com/rss/cnn_us.rss";
            WebRequest   objRequest     = WebRequest.Create(url);
            Stream       responseStream = objRequest.GetResponse().GetResponseStream();

            if (responseStream != null)
            {
                String rssContent = new StreamReader(responseStream).ReadToEnd();

                PrintMessage("Raw RSS Feed:");
                PrintXmlData(rssContent);


                /*
                 * Get the simpl types scope. This references all of the classes that we
                 * are considering for translation.
                 */
                SimplTypesScope rssScope = SimplTypesScope.Get("rss", typeof(Rss), typeof(Channel), typeof(Item));

                /*
                 * Instantiate Rss by translating the xml to C# objects. Take a
                 * look at Rss, Channel, and Item to see how they are annotated to
                 * facilitate translation. Notice that Rss's class tag is rss. This is
                 * an inherent rule: all classes that subclass ElementState have a class
                 * tag of just the class name. Normally Simpl.Serialization uses a camel-case
                 * translatio. Fields that are translated into attributes
                 * and sub elements use a similar convention for determining identifiers.
                 */
                Rss feed = (Rss)rssScope.Deserialize(rssContent, StringFormat.Xml);

                /*
                 * Notice that, translated back to xml, not all attributes and elements
                 * still remain. If an attribute or element is not annotated in the
                 * corresponding class it is simply ignored.
                 */
                PrintMessage("Feed Translated back to XML by Simpl.Serializaion");
                TestHelper.TestMethods.TestSerialization(feed, Format.Xml);

                /*
                 * Create our own item to add to the channel
                 */
                Item ecologylabItem = new Item
                {
                    Title       = "The Interface Ecology Lab",
                    Description = "Highlights the cool research going on at the lab.",
                    Author      = "Dr. Andruid Kerne",
                    Link        = new ParsedUri("http://www.ecologylab.net")
                };

                /*
                 * Add our item to the front of the channel.
                 */
                feed.Channel.Items.Insert(0, ecologylabItem);

                PrintMessage("Feed Translated back to XML with our added item");
                TestHelper.TestMethods.TestSerialization(feed, Format.Xml);
            }
        }
Esempio n. 28
0
 public static SimplTypesScope Get()
 {
     return(SimplTypesScope.Get(ConditionScope, Classes));
 }
 public static SimplTypesScope Get()
 {
     return(SimplTypesScope.Get(PackageName, Translations));
 }
 public static SimplTypesScope Get()
 {
     return(SimplTypesScope.Get(ScopeName, semanticActionClasses));
 }