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


C# Compiler.ParseAvtAttribute方法代码示例

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


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

示例1: Compile

		protected override void Compile (Compiler c)
		{
			if (c.Debugger != null)
				c.Debugger.DebugCompile (c.Input);

			XPathNavigator nav = c.Input.Clone ();
			nsDecls = c.GetNamespacesToCopy ();

			c.CheckExtraAttributes ("attribute", "name", "namespace");

			name = c.ParseAvtAttribute ("name");
			if (name == null)
				throw new XsltCompileException ("Attribute \"name\" is required on XSLT attribute element", null, c.Input);
			ns = c.ParseAvtAttribute ("namespace");

			calcName = XslAvt.AttemptPreCalc (ref name);
			calcPrefix = String.Empty;

			if (calcName != null) {
				int colonAt = calcName.IndexOf (':');
				calcPrefix = colonAt < 0 ? String.Empty : calcName.Substring (0, colonAt);
				calcName = colonAt < 0 ? calcName : calcName.Substring (colonAt + 1, calcName.Length - colonAt - 1);

				try {
					XmlConvert.VerifyNCName (calcName);
					if (calcPrefix != String.Empty)
						XmlConvert.VerifyNCName (calcPrefix);
				} catch (XmlException ex) {
					throw new XsltCompileException ("Invalid attribute name", ex, c.Input);
				}
			}

			if (calcPrefix != String.Empty) {
				calcPrefix = c.CurrentStylesheet.GetActualPrefix (calcPrefix);
				if (calcPrefix == null)
					calcPrefix = String.Empty;
			}

			if (calcPrefix != String.Empty && ns == null)
				calcNs = nav.GetNamespace (calcPrefix);
			else if (ns != null)
				calcNs = XslAvt.AttemptPreCalc (ref ns);

			if (c.Input.MoveToFirstChild ()) {
				value = c.CompileTemplateContent (XPathNodeType.Attribute);
				c.Input.MoveToParent ();
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:48,代码来源:XslAttribute.cs

示例2: Compile

		protected override void Compile (Compiler c)
		{
			if (c.Debugger != null)
				c.Debugger.DebugCompile (c.Input);

			c.CheckExtraAttributes ("element", "name", "namespace", "use-attribute-sets");

			name = c.ParseAvtAttribute ("name");
			ns = c.ParseAvtAttribute ("namespace");
			nsDecls = c.GetNamespacesToCopy ();
			calcName = XslAvt.AttemptPreCalc (ref name);
			
			if (calcName != null) {
				int colonAt = calcName.IndexOf (':');
				if (colonAt == 0)
					throw new XsltCompileException ("Invalid name attribute", null, c.Input);
				calcPrefix = colonAt < 0 ? String.Empty : calcName.Substring (0, colonAt);
				if (colonAt > 0)
					calcName = calcName.Substring (colonAt + 1);

				try {
					XmlConvert.VerifyNCName (calcName);
					if (calcPrefix != String.Empty)
						XmlConvert.VerifyNCName (calcPrefix);
				} catch (XmlException ex) {
					throw new XsltCompileException ("Invalid name attribute", ex, c.Input);
				}

				if (ns == null) {
					calcNs = c.Input.GetNamespace (calcPrefix);
					if (calcPrefix != String.Empty && calcNs == String.Empty)
						throw new XsltCompileException ("Invalid name attribute", null, c.Input);
				}
			} else if (ns != null)
				calcNs = XslAvt.AttemptPreCalc (ref ns);
			
			useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets");
			
			isEmptyElement = c.Input.IsEmptyElement;

			if (c.Input.MoveToFirstChild ()) {
				value = c.CompileTemplateContent (XPathNodeType.Element);
				c.Input.MoveToParent ();
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:45,代码来源:XslElement.cs

示例3: Compile

		protected override void Compile (Compiler c)
		{
			if (c.Debugger != null)
				c.Debugger.DebugCompile (this.DebugInput);

			c.CheckExtraAttributes ("processing-instruction", "name");

			name = c.ParseAvtAttribute ("name");

			if (!c.Input.MoveToFirstChild ()) return;
			
			value = c.CompileTemplateContent (XPathNodeType.ProcessingInstruction);
			c.Input.MoveToParent ();
		}
开发者ID:nobled,项目名称:mono,代码行数:14,代码来源:XslProcessingInstruction.cs

示例4: Compile

		protected override void Compile (Compiler c)
		{
			if (c.Debugger != null)
				c.Debugger.DebugCompile (this.DebugInput);

			c.CheckExtraAttributes ("number", "level", "count", "from", "value", "format", "lang", "letter-value", "grouping-separator", "grouping-size");

			switch (c.GetAttribute ("level"))
			{
			case "single":
				level = XslNumberingLevel.Single;
				break;
			case "multiple":
				level = XslNumberingLevel.Multiple;
				break;
			case "any":
				level = XslNumberingLevel.Any;
				break;
			case null:
			case "":
			default:
				level = XslNumberingLevel.Single; // single == default
				break;
			}
			
			count = c.CompilePattern (c.GetAttribute ("count"), c.Input);
			from = c.CompilePattern (c.GetAttribute ("from"), c.Input);
			value = c.CompileExpression (c.GetAttribute ("value"));
			
			format = c.ParseAvtAttribute ("format");
			lang = c.ParseAvtAttribute ("lang");
			letterValue = c.ParseAvtAttribute ("letter-value");
			groupingSeparator = c.ParseAvtAttribute ("grouping-separator");
			groupingSize = c.ParseAvtAttribute ("grouping-size");
		}
开发者ID:xzkmxd,项目名称:mono,代码行数:35,代码来源:XslNumber.cs


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