Пример #1
0
        public void DumpOneNode()
        {
            CError.Write("NodeType  = " + NodeType + "\t|\t");
            CError.Write("NodeName  = " + Name + "\t|\t");
            CError.Write("NodeLocalName  = " + LocalName + "\t|\t");
            CError.Write("NodeNamespace  = " + NamespaceURI + "\t|\t");
            CError.Write("NodePrefix  = " + Prefix + "\t|\t");
            CError.Write("NodeHasValue  = " + (HasValue).ToString() + "\t|\t");
            CError.Write("NodeValue = " + Value + "\t|\t");
            CError.Write("NodeDepth = " + Depth + "\t|\t");
            CError.Write("IsEmptyElement = " + (IsEmptyElement).ToString() + "\t|\t");
            CError.Write("IsDefault = " + (IsDefault).ToString() + "\t|\t");
            CError.Write("XmlSpace = " + XmlSpace + "\t|\t");
            CError.Write("XmlLang = " + XmlLang + "\t|\t");

            CError.Write("AttributeCount = " + AttributeCount + "\t|\t");
            CError.Write("HasAttributes = " + (HasAttributes).ToString() + "\t|\t");

            CError.Write("EOF = " + (EOF).ToString() + "\t|\t");
            CError.Write("ReadState = " + (ReadState).ToString() + "\t|\t");

            if (AttributeCount > 0)
            {
                CError.WriteLine();
                for (int i = 0; i < AttributeCount; i++)
                {
                    CError.Write("GetAttribute(" + i + ")= " + GetAttribute(i) + "\t|\t");
                }
            }

            CError.WriteLine();
        }
Пример #2
0
        public int TestTextReadBinHex_24()
        {
            string filename = TestData + "Common/Bug99148.xml";

            ReloadSource(filename);

            DataReader.MoveToContent();
            int bytes = -1;

            DataReader.Read();
            if (CheckCanReadBinaryContent())
            {
                return(TEST_PASS);
            }

            StringBuilder output = new StringBuilder();

            while (bytes != 0)
            {
                byte[] bbb = new byte[1024];
                bytes = DataReader.ReadContentAsBinHex(bbb, 0, bbb.Length);
                for (int i = 0; i < bytes; i++)
                {
                    CError.Write(bbb[i].ToString());
                    output.AppendFormat(bbb[i].ToString());
                }
            }

            CError.WriteLine();
            CError.WriteLine("Length of the output : " + output.ToString().Length);
            return((CError.Compare(output.ToString().Length, 1735, "Expected Length : 1735")) ? TEST_PASS : TEST_FAIL);
        }
Пример #3
0
        ////////////////////////////////////////////////////////////////
        // Dump ALL properties
        //
        ////////////////////////////////////////////////////////////////
        public void DumpAll()
        {
            while (Read())
            {
                CError.Write("NodeType  = " + NodeType + "\t|\t");
                CError.Write("NodeName  = " + Name + "\t|\t");
                CError.Write("NodeLocalName  = " + LocalName + "\t|\t");
                CError.Write("NodeNamespace  = " + NamespaceURI + "\t|\t");
                CError.Write("NodePrefix  = " + Prefix + "\t|\t");
                CError.Write("NodeHasValue  = " + (HasValue).ToString() + "\t|\t");
                CError.Write("NodeValue = " + Value + "\t|\t");
                CError.Write("NodeDepth = " + Depth + "\t|\t");
                CError.Write("IsEmptyElement = " + IsEmptyElement.ToString() + "\t|\t");
                CError.Write("IsDefault = " + IsDefault.ToString() + "\t|\t");
                CError.Write("XmlSpace = " + XmlSpace + "\t|\t");
                CError.Write("XmlLang = " + XmlLang + "\t|\t");

                CError.Write("AttributeCount = " + AttributeCount + "\t|\t");
                CError.Write("HasAttributes = " + HasAttributes.ToString() + "\t|\t");

                CError.Write("EOF = " + EOF.ToString() + "\t|\t");
                CError.Write("ReadState = " + ReadState.ToString() + "\t|\t");
                CError.WriteLine();
            }
        }
Пример #4
0
        public int CDocument()
        {
            XmlReaderSettings rs = new XmlReaderSettings();

            rs.ConformanceLevel = ConformanceLevel.Document;
            object[] xml = GetAllPri0ConformanceTestXmlStrings();
            if (xml.Length > s_pri0ExpectedDocument.Length)
            {
                CError.WriteLine("Invalid Compare attempted");
                return(TEST_FAIL);
            }

            bool failed = false;

            for (int i = 0; i < xml.Length; i++)
            {
                XmlReader reader = ReaderHelper.Create(new StringReader((string)xml[i]), rs, (string)null);
                bool      actual = false;
                try
                {
                    while (reader.Read())
                    {
                        ;
                    }
                }
                catch (XmlException xe)
                {
                    CError.Write("Case : " + (i + 1));
                    CError.WriteLine(xe.Message);
                    actual = true;
                }

                if (actual != s_pri0ExpectedDocument[i])
                {
                    CError.WriteLine("ConformanceLevel = Document");
                    CError.WriteLine("Test Failed for Case" + (i + 1));
                    CError.WriteLine("|" + (string)xml[i] + "|");
                    failed = true;
                }
            }

            if (failed)
            {
                return(TEST_FAIL);
            }

            return(TEST_PASS);
        }