Пример #1
0
        private void LoadXmlDocumentInput(XmlDocument doc)
        {
            // Use C14N to get a document
            XmlResolver  resolver = (this.ResolverSet ? this.m_xmlResolver : new XmlSecureResolver(new XmlUrlResolver(), this.BaseURI));
            CanonicalXml c14n     = new CanonicalXml(doc, resolver, true);

            using (MemoryStream ms = new MemoryStream(c14n.GetBytes()))
            {
                LoadStreamInput(ms);
            }
        }
Пример #2
0
        public void BigCombinedRule_ParsesCorrectly()
        {
            // certainly some of this actually doesn't form semantically vaild ICU, but it should be syntactically correct
            const string icu = "[strength 3] [alternate shifted]\n[backwards 2]&[before 1][ first  regular]<b<\\u"
                               + "<'cde'&gh<<p<K|Q/\\<<[last variable]<<4<[variable\ttop]\t<9";

            _icuParser.WriteIcuRules(_writer, icu);
            string result   = Environment_OutputString();
            string expected = CanonicalXml.ToCanonicalStringFragment(
                "<settings alternate=\"shifted\" backwards=\"on\" variableTop=\"u34\" strength=\"tertiary\" />"
                + "<rules><reset before=\"primary\"><first_non_ignorable /></reset>"
                + "<pc>bu</pc><p>cde</p><reset>gh</reset><s>p</s>"
                + "<x><context>K</context><p>Q</p><extend>&lt;</extend></x>"
                + "<p><last_variable /></p><s>4</s><p>9</p></rules>"
                );

            Assert.AreEqual(expected, result);
        }