This project is read-only.

Using CRecords class to work with MARCXML record collection.


            CRecords recCollection;
            CRecord myRec;
            CControlfield Cf;
            CDatafield Df;
            CSubfield Sf;
            //Working with MARCXML record collection.
            recCollection = new CRecords();
            //load data from xmlstring
            //recCollection.load_Xml("<collection><record>...</record><record>...</record><record>...</record></collection>");
            //load from file
            recCollection.load_File("collection.xml");
            Console.WriteLine("Number of records in the collection is:" + recCollection.Count.ToString());
            //loop each record in the collection
            for (int i = 0; i < recCollection.Count; i++)
            {
                myRec = recCollection.Record(i);
                Console.WriteLine(String.Format("record{0}:{1}",i,myRec.Datafields.Datafield("245").SubfieldsText));
            }
            //filter records to get list of matched
            recCollection.Filter("245", "Ray Charles", false);
            Console.WriteLine("Number of matched records:" + recCollection.Count.ToString());
            //un filter by refresh
            recCollection.Refresh();
            Console.WriteLine("Number of all records:" + recCollection.Count.ToString());


Last edited Oct 24, 2011 at 4:07 PM by mansofta, version 6

Comments

No comments yet.