当前位置: 首页>>代码示例>>C#>>正文


C# Compiler.Advance方法代码示例

本文整理汇总了C#中System.Xml.Xsl.Compiler.Advance方法的典型用法代码示例。如果您正苦于以下问题:C# Compiler.Advance方法的具体用法?C# Compiler.Advance怎么用?C# Compiler.Advance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Xsl.Compiler的用法示例。


在下文中一共展示了Compiler.Advance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompileContent

        private void CompileContent(Compiler compiler) {
            NavigatorInput input = compiler.Input;
            
            if (compiler.Recurse()) {
                do {
                    Debug.Trace(input);
                    switch(input.NodeType) {
                    case XPathNodeType.Element:
                        compiler.PushNamespaceScope();
                        string nspace = input.NamespaceURI;
                        string name   = input.LocalName;

                        if (Keywords.Equals(nspace, input.Atoms.XsltNamespace) && Keywords.Equals(name, input.Atoms.WithParam)) {
                                WithParamAction par = compiler.CreateWithParamAction();
                                CheckDuplicateParams(par.Name);
                                AddAction(par);
                        }
                        else {
                            throw XsltException.UnexpectedKeyword(compiler);
                        }
                        compiler.PopScope();
                        break;
                    case XPathNodeType.Comment:
                    case XPathNodeType.ProcessingInstruction:
                    case XPathNodeType.Whitespace:
                    case XPathNodeType.SignificantWhitespace:
                        break;
                    default:
                        throw new XsltException(Res.Xslt_InvalidContents, Keywords.s_CallTemplate);
                    }
                } while(compiler.Advance());

                compiler.ToParent();
            }
        }
开发者ID:ArildF,项目名称:masters,代码行数:35,代码来源:calltemplateaction.cs

示例2: CompileConditions

        private void CompileConditions(Compiler compiler) {
            NavigatorInput input = compiler.Input;
            bool when       = false;
            bool otherwise  = false;

            do {
                Debug.Trace(input);

                switch (input.NodeType) {
                case XPathNodeType.Element:
                    compiler.PushNamespaceScope();
                    string nspace = input.NamespaceURI;
                    string name   = input.LocalName;

                    if (Keywords.Equals(nspace, input.Atoms.XsltNamespace)) {
                        IfAction action = null;
                        if (Keywords.Equals(name, input.Atoms.When) && ! otherwise) {
                            action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen);
                            when = true;
                        }
                        else if (Keywords.Equals(name, input.Atoms.Otherwise) && ! otherwise) {
                            action = compiler.CreateIfAction(IfAction.ConditionType.ConditionOtherwise);
                            otherwise = true;
                        }
                        else {
                            throw XsltException.UnexpectedKeyword(compiler);
                        }
                        AddAction(action);
                    }
                    else {
                        throw XsltException.UnexpectedKeyword(compiler);
                    }
                    compiler.PopScope();
                    break;

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

                default:
                    throw new XsltException(Res.Xslt_InvalidContents, Keywords.s_Choose);
                }
            }
            while (compiler.Advance());
            if (! when) {
                throw new XsltException(Res.Xslt_NoWhen);
            }
        }
开发者ID:ArildF,项目名称:masters,代码行数:50,代码来源:chooseaction.cs

示例3: CompileSelectiveTemplate

 internal void CompileSelectiveTemplate(Compiler compiler){
     NavigatorInput input = compiler.Input;
     do{
         if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace) &&
             Keywords.Equals(input.LocalName, input.Atoms.Fallback)){
             fallback = true;
             if (compiler.Recurse()){
                 CompileTemplate(compiler);
                 compiler.ToParent();
             }
         }
     }
     while (compiler.Advance());
 }
开发者ID:ArildF,项目名称:masters,代码行数:14,代码来源:newinstructionaction.cs

示例4: CheckEmpty

 public void CheckEmpty(Compiler compiler) {
     // Really EMPTY means no content atall but for compatibility with MSXML we allow whitespace
     if (compiler.Recurse()) {
         do {
             if(
                 compiler.Input.NodeType != XPathNodeType.Whitespace            &&
                 compiler.Input.NodeType != XPathNodeType.Comment               &&
                 compiler.Input.NodeType != XPathNodeType.ProcessingInstruction
             ) {
                 compiler.ToParent();
                 throw new XsltException(Res.Xslt_EmptyTagRequired, compiler.Input.LocalName);
             }
         }
         while (compiler.Advance());
         compiler.ToParent();
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:17,代码来源:compiledaction.cs

示例5: CompileContent

        private void CompileContent(Compiler compiler) {
            if (compiler.Recurse()) {
                NavigatorInput input = compiler.Input;

                this.text = String.Empty;

                do {
                    switch (input.NodeType) {
                    case XPathNodeType.Text:
                    case XPathNodeType.Whitespace:
                    case XPathNodeType.SignificantWhitespace:
                        this.text += input.Value;
                        break;
                    case XPathNodeType.Comment:
                    case XPathNodeType.ProcessingInstruction:
                        break;
                    default:
                        throw XsltException.UnexpectedKeyword(compiler);
                    }
                } while(compiler.Advance());
                compiler.ToParent();
            }
        }
开发者ID:ArildF,项目名称:masters,代码行数:23,代码来源:textaction.cs

示例6: CompileTemplate

 protected void CompileTemplate(Compiler compiler) {
     do {
         CompileOnceTemplate(compiler);
     }
     while (compiler.Advance());
 }
开发者ID:ArildF,项目名称:masters,代码行数:6,代码来源:containeraction.cs

示例7: 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

示例8: CompileDocument

        // CompileTopLevelElements
        protected void CompileDocument(Compiler compiler, bool inInclude) {
            NavigatorInput input = compiler.Input;

            // SkipToElement :
            while (input.NodeType != XPathNodeType.Element) {
                if (! compiler.Advance()) {
                    throw new XsltException(Res.Xslt_WrongStylesheetElement);
                }
            }

            Debug.Assert(compiler.Input.NodeType == XPathNodeType.Element);
            if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace)) {
                if (
                    ! Keywords.Equals(input.LocalName, input.Atoms.Stylesheet) &&
                    ! Keywords.Equals(input.LocalName, input.Atoms.Transform)
                ) {
                    throw new XsltException(Res.Xslt_WrongStylesheetElement);
                }
                compiler.PushNamespaceScope();
                CompileStylesheetAttributes(compiler);
                CompileTopLevelElements(compiler);
                if (! inInclude) {
                    CompileImports(compiler);
                }
            }
            else {
                // single template
                compiler.PushLiteralScope();
                CompileSingleTemplate(compiler);
            }

            compiler.PopScope();
        }
开发者ID:ArildF,项目名称:masters,代码行数:34,代码来源:containeraction.cs


注:本文中的System.Xml.Xsl.Compiler.Advance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。