當前位置: 首頁>>代碼示例>>C#>>正文


C# Compiler.CreateVariableAction方法代碼示例

本文整理匯總了C#中System.Xml.Xsl.Compiler.CreateVariableAction方法的典型用法代碼示例。如果您正苦於以下問題:C# Compiler.CreateVariableAction方法的具體用法?C# Compiler.CreateVariableAction怎麽用?C# Compiler.CreateVariableAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.Xsl.Compiler的用法示例。


在下文中一共展示了Compiler.CreateVariableAction方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CompileInstruction

        void CompileInstruction(Compiler compiler) {
            NavigatorInput input  = compiler.Input;
            CompiledAction action = null;

            Debug.Assert(Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace));

            string name = input.LocalName;

            if (Keywords.Equals(name, input.Atoms.ApplyImports)) {
                action = compiler.CreateApplyImportsAction();
            }
            else if (Keywords.Equals(name, input.Atoms.ApplyTemplates)) {
                action = compiler.CreateApplyTemplatesAction();
            }
            else if (Keywords.Equals(name, input.Atoms.Attribute)) {
                action = compiler.CreateAttributeAction();
            }
            else if (Keywords.Equals(name, input.Atoms.CallTemplate)) {
                action = compiler.CreateCallTemplateAction();
            }
            else if (Keywords.Equals(name, input.Atoms.Choose)) {
                action = compiler.CreateChooseAction();
            }
            else if (Keywords.Equals(name, input.Atoms.Comment)) {
                action = compiler.CreateCommentAction();
            }
            else if (Keywords.Equals(name, input.Atoms.Copy)) {
                action = compiler.CreateCopyAction();
            }
            else if (Keywords.Equals(name, input.Atoms.CopyOf)) {
                action = compiler.CreateCopyOfAction();
            }
            else if (Keywords.Equals(name, input.Atoms.Element)) {
                action = compiler.CreateElementAction();
            }
            else if (Keywords.Equals(name, input.Atoms.Fallback)) {
                return;
            }
            else if (Keywords.Equals(name, input.Atoms.ForEach)) {
                action = compiler.CreateForEachAction();
            }
            else if (Keywords.Equals(name, input.Atoms.If)) {
                action = compiler.CreateIfAction(IfAction.ConditionType.ConditionIf);
            }
            else if (Keywords.Equals(name, input.Atoms.Message)) {
                action = compiler.CreateMessageAction();
            }
            else if (Keywords.Equals(name, input.Atoms.Number)) {
                action = compiler.CreateNumberAction();
            }
            else if (Keywords.Equals(name, input.Atoms.ProcessingInstruction)) {
                action = compiler.CreateProcessingInstructionAction();
            }
            else if (Keywords.Equals(name, input.Atoms.Text)) {
                action = compiler.CreateTextAction();
            }
            else if (Keywords.Equals(name, input.Atoms.ValueOf)) {
                action = compiler.CreateValueOfAction();
            }
            else if (Keywords.Equals(name, input.Atoms.Variable)) {
                action = compiler.CreateVariableAction(VariableType.LocalVariable);
            }
            else {
                if (compiler.ForwardCompatibility)
                    action = compiler.CreateNewInstructionAction();
                else
                    throw XsltException.UnexpectedKeyword(compiler);
            }

            Debug.Assert(action != null);

            AddAction(action);
        }
開發者ID:ArildF,項目名稱:masters,代碼行數:73,代碼來源:containeraction.cs

示例2: CompileParameters

 protected void CompileParameters(Compiler compiler) {
     NavigatorInput input = compiler.Input;
     do {
         switch(input.NodeType) {
         case XPathNodeType.Element:
             if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace) &&
                 Keywords.Equals(input.LocalName, input.Atoms.Param)) {
                 compiler.PushNamespaceScope();
                 AddAction(compiler.CreateVariableAction(VariableType.LocalParameter));
                 compiler.PopScope();
                 continue;
             }
             else {
                 return;
             }
         case XPathNodeType.Text:
             return;
         case XPathNodeType.SignificantWhitespace:
             this.AddEvent(compiler.CreateTextEvent());
             continue;
         default :
             continue;
         }
     }
     while (input.Advance());
 }
開發者ID:ArildF,項目名稱:masters,代碼行數:26,代碼來源:templateaction.cs

示例3: CompileTopLevelElements

        protected void CompileTopLevelElements(Compiler compiler) {
            // Navigator positioned at parent root, need to move to child and then back
            if (compiler.Recurse() == false) {
                Debug.WriteLine("Nothing to compile, exiting");
                return;
            }

            NavigatorInput input    = compiler.Input;
            bool notFirstElement    = false;
            do {
                Debug.Trace(input);
                switch (input.NodeType) {
                case XPathNodeType.Element:
                    string name   = input.LocalName;
                    string nspace = input.NamespaceURI;

                    if (Keywords.Equals(nspace, input.Atoms.XsltNamespace)) {
                        if (Keywords.Equals(name, input.Atoms.Import)) {
                            if (notFirstElement) {
                                throw new XsltException(Res.Xslt_NotFirstImport);
                            }
                            // We should compile imports in reverse order after all toplevel elements.
                            // remember it now and return to it in CompileImpoorts();
                            compiler.CompiledStylesheet.Imports.Add(compiler.GetSingleAttribute(compiler.Input.Atoms.Href));
                        }
                        else if (Keywords.Equals(name, input.Atoms.Include)) {
                            notFirstElement = true;                     
                            CompileInclude(compiler);
                        }
                        else {
                            notFirstElement = true;
                            compiler.PushNamespaceScope();
                            if (Keywords.Equals(name, input.Atoms.StripSpace)) {
                                CompileSpace(compiler, false);
                            }
                            else if (Keywords.Equals(name, input.Atoms.PreserveSpace)) {
                                CompileSpace(compiler, true);
                            }
                            else if (Keywords.Equals(name, input.Atoms.Output)) {
                                CompileOutput(compiler);
                            }
                            else if (Keywords.Equals(name, input.Atoms.Key)) {
                                CompileKey(compiler);
                            }
                            else if (Keywords.Equals(name, input.Atoms.DecimalFormat)) {
                                CompileDecimalFormat(compiler);
                            }
                            else if (Keywords.Equals(name, input.Atoms.NamespaceAlias)) {
                                CompileNamespaceAlias(compiler);
                            }
                            else if (Keywords.Equals(name, input.Atoms.AttributeSet)) {
                                compiler.AddAttributeSet(compiler.CreateAttributeSetAction());
                            }
                            else if (Keywords.Equals(name, input.Atoms.Variable)) {
                                VariableAction action = compiler.CreateVariableAction(VariableType.GlobalVariable);
                                if (action != null) {
                                    AddAction(action);
                                }
                            }
                            else if (Keywords.Equals(name, input.Atoms.Param)) {
                                VariableAction action = compiler.CreateVariableAction(VariableType.GlobalParameter);
                                if (action != null) {
                                    AddAction(action);
                                }
                            }
                            else if (Keywords.Equals(name, input.Atoms.Template)) {
                                compiler.AddTemplate(compiler.CreateTemplateAction());
                            }
                            else {
                                if (!compiler.ForwardCompatibility) {
                                    throw XsltException.UnexpectedKeyword(compiler);
                                }
                            }
                            compiler.PopScope();
                        }
                    }
                    else if (nspace == input.Atoms.MsXsltNamespace && name == input.Atoms.Script) {
                        AddScript(compiler);
                    }
                    else {
                        if (Keywords.Equals(nspace, input.Atoms.Empty)) {
                            throw new XsltException(Res.Xslt_NullNsAtTopLevel, input.Name);
                        }
                        // Ignoring non-recognized namespace per XSLT spec 2.2
                    }
                    break;

                case XPathNodeType.ProcessingInstruction:
                case XPathNodeType.Comment:
                case XPathNodeType.Whitespace:
                case XPathNodeType.SignificantWhitespace:
                    break;

                default:
                    throw new XsltException(Res.Xslt_InvalidContents, "xsl:stylesheet");
                }
            }
            while (compiler.Advance());

            compiler.ToParent();
//.........這裏部分代碼省略.........
開發者ID:ArildF,項目名稱:masters,代碼行數:101,代碼來源:containeraction.cs


注:本文中的System.Xml.Xsl.Compiler.CreateVariableAction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。