예제 #1
0
        private string CustomizeRequest(CreatorIssuer key, XmlNamespaceManager cont)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            string text = (key._0003() == null || (key._0001() == "xmlns" && key._0003() == "http://www.w3.org/2000/xmlns/")) ? null : cont.LookupPrefix(key._0003());

            if (!SetterTest.StartReader(text))
            {
                return(text + ":" + XmlConvert.DecodeName(key._0001()));
            }
            return(XmlConvert.DecodeName(key._0001()));
        }
예제 #2
0
        private string QueryRequest(CreatorIssuer first, XmlNamespaceManager connection)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            switch (first._0001())
            {
            case XmlNodeType.Attribute:
                if (first._0003() == "http://james.newtonking.com/projects/json")
                {
                    return("$" + first._0001());
                }
                return("@" + CustomizeRequest(first, connection));

            case XmlNodeType.CDATA:
                return("#cdata-section");

            case XmlNodeType.Comment:
                return("#comment");

            case XmlNodeType.Element:
                if (first._0003() == "http://james.newtonking.com/projects/json")
                {
                    return("$" + first._0001());
                }
                return(CustomizeRequest(first, connection));

            case XmlNodeType.ProcessingInstruction:
                return("?" + CustomizeRequest(first, connection));

            case XmlNodeType.DocumentType:
                return("!" + CustomizeRequest(first, connection));

            case XmlNodeType.XmlDeclaration:
                return("?xml");

            case XmlNodeType.SignificantWhitespace:
                return("#significant-whitespace");

            case XmlNodeType.Text:
                return("#text");

            case XmlNodeType.Whitespace:
                return("#whitespace");

            default:
                throw new StrategyError("Unexpected XmlNodeType when getting node name: " + first._0001());
            }
        }
예제 #3
0
        private void InitRequest(RecordClassDispatcher first, CreatorIssuer second, XmlNamespaceManager template, bool isresult2)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            switch (second._0001())
            {
            case XmlNodeType.Document:
            case XmlNodeType.DocumentFragment:
                ExcludeRequest(first, second, template, isresult2);
                break;

            case XmlNodeType.Element:
                if (CancelRequest(second) && DefineRequest(second) && second._0001().Count > 0)
                {
                    ExcludeRequest(first, second, template, hasattr2: false);
                    break;
                }
                template.PushScope();
                foreach (CreatorIssuer item in second._0002())
                {
                    if (item._0003() == "http://www.w3.org/2000/xmlns/")
                    {
                        string prefix = (item._0001() != "xmlns") ? XmlConvert.DecodeName(item._0001()) : string.Empty;
                        string text   = item._0002();
                        if (text == null)
                        {
                            throw new StrategyError("Namespace attribute must have a value.");
                        }
                        template.AddNamespace(prefix, text);
                    }
                }
                if (isresult2)
                {
                    first._0002(QueryRequest(second, template));
                }
                if (!ResolveIterator(second._0002()) && second._0001().Count == 1 && second._0001()[0]._0001() == XmlNodeType.Text)
                {
                    first._0004(second._0001()[0]._0002());
                }
                else if (second._0001().Count == 0 && second._0002().Count == 0)
                {
                    if (((InfoRequestStrategy)second)._0001())
                    {
                        first._0008();
                    }
                    else
                    {
                        first._0004(string.Empty);
                    }
                }
                else
                {
                    first._0002();
                    for (int i = 0; i < second._0002().Count; i++)
                    {
                        InitRequest(first, second._0002()[i], template, isresult2: true);
                    }
                    ExcludeRequest(first, second, template, hasattr2: true);
                    first._0011();
                }
                template.PopScope();
                break;

            case XmlNodeType.Comment:
                if (isresult2)
                {
                    first._0005(second._0002());
                }
                break;

            case XmlNodeType.Attribute:
            case XmlNodeType.Text:
            case XmlNodeType.CDATA:
            case XmlNodeType.ProcessingInstruction:
            case XmlNodeType.Whitespace:
            case XmlNodeType.SignificantWhitespace:
                if ((!(second._0003() == "http://www.w3.org/2000/xmlns/") || !(second._0002() == "http://james.newtonking.com/projects/json")) && (!(second._0003() == "http://james.newtonking.com/projects/json") || !(second._0001() == "Array")))
                {
                    if (isresult2)
                    {
                        first._0002(QueryRequest(second, template));
                    }
                    first._0004(second._0002());
                }
                break;

            case XmlNodeType.XmlDeclaration:
            {
                DicEventConsumer dicEventConsumer = (DicEventConsumer)second;
                first._0002(QueryRequest(second, template));
                first._0002();
                if (!SetterTest.StartReader(dicEventConsumer._0004()))
                {
                    first._0002("@version");
                    first._0004(dicEventConsumer._0004());
                }
                if (!SetterTest.StartReader(dicEventConsumer._0005()))
                {
                    first._0002("@encoding");
                    first._0004(dicEventConsumer._0005());
                }
                if (!SetterTest.StartReader(dicEventConsumer._0006()))
                {
                    first._0002("@standalone");
                    first._0004(dicEventConsumer._0006());
                }
                first._0011();
                break;
            }

            case XmlNodeType.DocumentType:
            {
                IndexerIssuer indexerIssuer = (IndexerIssuer)second;
                first._0002(QueryRequest(second, template));
                first._0002();
                if (!SetterTest.StartReader(indexerIssuer._0004()))
                {
                    first._0002("@name");
                    first._0004(indexerIssuer._0004());
                }
                if (!SetterTest.StartReader(indexerIssuer._0006()))
                {
                    first._0002("@public");
                    first._0004(indexerIssuer._0006());
                }
                if (!SetterTest.StartReader(indexerIssuer._0005()))
                {
                    first._0002("@system");
                    first._0004(indexerIssuer._0005());
                }
                if (!SetterTest.StartReader(indexerIssuer._0007()))
                {
                    first._0002("@internalSubset");
                    first._0004(indexerIssuer._0007());
                }
                first._0011();
                break;
            }

            default:
                throw new StrategyError("Unexpected XmlNodeType when serializing nodes: " + second._0001());
            }
        }