示例#1
0
        public int v1()
        {
            string strFile = NameTable_TestFiles.GetTestFileName(EREADER_TYPE.GENERIC);

            // create custom nametable
            MyXmlNameTable nt   = new MyXmlNameTable();
            string         play = nt.Add("PLAY");
            string         foo  = nt.Add("http://www.foo.com");

            XmlReaderSettings xrs = new XmlReaderSettings();

            xrs.NameTable     = nt;
            xrs.DtdProcessing = DtdProcessing.Ignore;
            XmlReader r = XmlReader.Create(FilePathUtil.getStream(strFile), xrs);

            while (r.Read())
            {
                ;
            }

            // verify name table
            object play2 = nt.Get("PLAY");
            object foo2  = nt.Get("http://www.foo.com");

            CError.Compare((object)play == play2, "play");
            CError.Compare((object)foo == foo2, "foo");

            CError.Compare(nt.Get("NONEMPTY0") != null, "NONEMPTY0");
            CError.WriteLine("Final count={0} atoms", nt.Count);

            return(TEST_PASS);
        }
示例#2
0
        protected void ReloadSource()
        {
            if (DataReader != null)
            {
                DataReader.Dispose();
            }

            string strFile = NameTable_TestFiles.GetTestFileName(EREADER_TYPE.GENERIC);

            DataReader = XmlReader.Create(FilePathUtil.getStream(strFile), new XmlReaderSettings()
            {
                DtdProcessing = DtdProcessing.Ignore
            });                                                                                                                              //new XmlTextReader(strFile);
        }