public string GetSimpleInvalidXml()
 {
     string invalidCharString = StringGen.GetIllegalXmlString(10, true);
     ManagedNodeWriter mn = new ManagedNodeWriter();
     mn.PutDecl();
     mn.OpenElement("�");
     mn.CloseElement();
     mn.PutText(invalidCharString);
     mn.PutEndElement();
     return mn.GetNodes();
 }
Beispiel #2
0
        // Entry point.
        public static void Main(string[] args)
        {
            string            filename = "temp.xml";
            ManagedNodeWriter mw       = new ManagedNodeWriter(filename);
            ManagedNodeWriter mnw      = new ManagedNodeWriter();

            mnw.PutPattern("X");

            int count = 0;

            do
            {
                mnw.PutPattern("E/");
                count++;
            } while (count < 65536);
            mnw.PutText("<a/>");
            mnw.Finish();
            StreamWriter sw = new StreamWriter(FilePathUtil.getStream("deep.xml"));

            sw.Write(mnw.GetNodes());
            sw.Dispose();
        }
Beispiel #3
0
        public int v2_1()
        {
            ManagedNodeWriter mnw = new ManagedNodeWriter();
            mnw.PutPattern("X");

            int count = 0;
            do
            {
                mnw.PutPattern("E/");
                count++;
            } while (count < 65536);
            mnw.PutText("<a/><b/>");
            mnw.Finish();

            CError.WriteIgnore(mnw.GetNodes() + "\n");

            ReloadSource(new StringReader(mnw.GetNodes()));
            DataReader.PositionOnElement("ELEMENT_0");

            CError.Compare(DataReader.ReadToDescendant("a"), "Couldnt go to Descendant");
            int depth = DataReader.Depth;

            CError.Compare(DataReader.ReadToNextSibling("b"), "Couldnt go to NextSibling");


            CError.Compare(DataReader.Depth, depth, "Depth is not correct");
            CError.Compare(DataReader.NodeType, XmlNodeType.Element, "Nodetype is not correct");

            while (DataReader.Read()) ;
            DataReader.Close();

            return TEST_PASS;
        }
Beispiel #4
0
        public int c03()
        {
            ManagedNodeWriter mn = new ManagedNodeWriter();
            mn.PutPattern("XE/");
            mn.PutText("--&gt;");
            mn.PutPattern("e");

            CError.WriteLineIgnore(mn.GetNodes());
            XmlReaderSettings rs = new XmlReaderSettings();
            XmlReader reader = null;

            rs.IgnoreComments = true;
            reader = ReaderHelper.Create(new StringReader(mn.GetNodes()), rs, (string)null);

            while (reader.Read()) ;
            reader.Dispose();

            return TEST_PASS;
        }
Beispiel #5
0
        // Entry point.
        public static void Main(string[] args)
        {
            string filename = "temp.xml";
            ManagedNodeWriter mw = new ManagedNodeWriter(filename);
            ManagedNodeWriter mnw = new ManagedNodeWriter();
            mnw.PutPattern("X");

            int count = 0;
            do
            {
                mnw.PutPattern("E/");
                count++;
            } while (count < 65536);
            mnw.PutText("<a/>");
            mnw.Finish();
            StreamWriter sw = new StreamWriter(FilePathUtil.getStream("deep.xml"));
            sw.Write(mnw.GetNodes());
            sw.Dispose();
        }
        //[Variation("Default Reader, Check Characters On and pass invalid characters in text", Pri = 0, Params = new object[] { "CoreValidatingReader" })]
        //[Variation("Default Reader, Check Characters On and pass invalid characters in text", Pri = 0, Params = new object[] { "CoreReader" })]
        public int v5()
        {
            string readerType = (string)this.CurVariation.Params[0];
            bool exceptionThrown = false;

            ManagedNodeWriter mn = new ManagedNodeWriter();
            mn.PutDecl();
            mn.OpenElement();
            mn.CloseElement();
            mn.PutText("&#xd800;"); //This is invalid char in XML.
            mn.PutEndElement();
            string invalidCharXml = mn.GetNodes();

            XmlReaderSettings rs = new XmlReaderSettings();
            rs.CheckCharacters = true;

            XmlReader reader = ReaderHelper.CreateReader(readerType, new StringReader(invalidCharXml), false, null, rs);
            try
            {
                while (reader.Read()) ;
            }
            catch (XmlException xe)
            {
                CError.WriteIgnore(invalidCharXml);
                CError.WriteLine(xe.Message);
                CError.WriteLine(xe.StackTrace);
                exceptionThrown = true;
            }

            mn.Close();
            reader.Dispose();

            if (!exceptionThrown)
                return TEST_FAIL;

            return TEST_PASS;
        }
Beispiel #7
0
        public int v2_1()
        {
            ManagedNodeWriter mnw = new ManagedNodeWriter();
            mnw.PutPattern("X");

            int count = 0;
            do
            {
                mnw.PutPattern("E/");
                count++;
            } while (count < 65536);
            mnw.PutText("<a/>");
            mnw.Finish();

            ReloadSource(new StringReader(mnw.GetNodes()));
            DataReader.PositionOnElement("ELEMENT_1");

            CError.WriteLine("Reading to : a");
            DataReader.ReadToDescendant("a");

            CError.Compare(DataReader.Depth, 65536, "Depth is not correct");
            CError.Compare(DataReader.NodeType, XmlNodeType.Element, "Nodetype is not correct");

            while (DataReader.Read()) ;
            DataReader.Close();

            return TEST_PASS;
        }