本文整理汇总了C#中System.Xml.Xsl.Compiler.AddPatternQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Compiler.AddPatternQuery方法的具体用法?C# Compiler.AddPatternQuery怎么用?C# Compiler.AddPatternQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Xsl.Compiler
的用法示例。
在下文中一共展示了Compiler.AddPatternQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompileAttribute
internal override bool CompileAttribute(Compiler compiler) {
string name = compiler.Input.LocalName;
string value = compiler.Input.Value;
if (Keywords.Equals(name, compiler.Atoms.Match)) {
Debug.Assert(this.match == null);
this.match = value;
this.matchKey = compiler.AddPatternQuery(value, /*allowVars:*/false, /*allowKey:*/true);
Debug.WriteLine("match attribute found: \"" + this.match + "\" (#" + this.matchKey + ")");
}
else if (Keywords.Equals(name, compiler.Atoms.Name)) {
Debug.Assert(this.name == null);
this.name = compiler.CreateXPathQName(value);
Debug.WriteLine("name attribute found: " + this.name);
}
else if (Keywords.Equals(name, compiler.Atoms.Priority)) {
Debug.Assert(Double.IsNaN(this.priority));
this.priority = XmlConvert.ToXPathDouble(value);
if (double.IsNaN(this.priority) && ! compiler.ForwardCompatibility) {
throw XsltException.InvalidAttrValue(Keywords.s_Priority, value);
}
}
else if (Keywords.Equals(name, compiler.Atoms.Mode)) {
Debug.Assert(this.mode == null);
if (compiler.AllowBuiltInMode && value.Trim() == "*") {
this.mode = Compiler.BuiltInMode;
}
else {
this.mode = compiler.CreateXPathQName(value);
}
Debug.WriteLine("mode attribute found: " + this.mode);
}
else {
return false;
}
return true;
}
示例2: CompileAttribute
internal override bool CompileAttribute(Compiler compiler) {
string name = compiler.Input.LocalName;
string value = compiler.Input.Value;
if (Keywords.Equals(name, compiler.Atoms.Level)) {
if (value != s_any && value != s_multiple && value != s_single) {
throw XsltException.InvalidAttrValue(Keywords.s_Level, value);
}
this.level = value;
}
else if (Keywords.Equals(name, compiler.Atoms.Count)) {
this.countPattern = value;
this.countKey = compiler.AddPatternQuery(value, /*allowVars:*/true, /*allowKey:*/true);
}
else if (Keywords.Equals(name, compiler.Atoms.From)) {
this.from = value;
this.fromKey = compiler.AddPatternQuery(value, /*allowVars:*/true, /*allowKey:*/true);
}
else if (Keywords.Equals(name, compiler.Atoms.Value)) {
this.value = value;
this.valueKey = compiler.AddQuery(value);
}
else if (Keywords.Equals(name, compiler.Atoms.Format)) {
this.formatAvt = Avt.CompileAvt(compiler, value);
Debug.WriteLine("name = \"" + value + "\"");
}
else if (Keywords.Equals(name, compiler.Atoms.Lang)) {
this.langAvt = Avt.CompileAvt(compiler, value);
Debug.WriteLine("name = \"" + value + "\"");
}
else if (Keywords.Equals(name, compiler.Atoms.LetterValue)) {
this.letterAvt = Avt.CompileAvt(compiler, value);
Debug.WriteLine("name = \"" + value + "\"");
}
else if (Keywords.Equals(name, compiler.Atoms.GroupingSeparator)) {
this.groupingSepAvt = Avt.CompileAvt(compiler, value);
Debug.WriteLine("name = \"" + value + "\"");
}
else if (Keywords.Equals(name, compiler.Atoms.GroupingSize)) {
this.groupingSizeAvt = Avt.CompileAvt(compiler, value);
Debug.WriteLine("name = \"" + value + "\"");
}
else {
return false;
}
return true;
}
示例3: CompileKey
internal void CompileKey(Compiler compiler){
NavigatorInput input = compiler.Input;
string element = input.LocalName;
int MatchKey = Compiler.InvalidQueryKey;
int UseKey = Compiler.InvalidQueryKey;
XmlQualifiedName Name = null;
if (input.MoveToFirstAttribute()) {
do {
Debug.TraceAttribute(input);
string nspace = input.NamespaceURI;
string name = input.LocalName;
string value = input.Value;
if (! Keywords.Equals(nspace, input.Atoms.Empty)) continue;
if (Keywords.Equals(name, input.Atoms.Name)) {
Name = compiler.CreateXPathQName(value);
}
else if (Keywords.Equals(name, input.Atoms.Match)) {
MatchKey = compiler.AddPatternQuery(value, /*allowVars:*/false, /*allowKey*/false);
}
else if (Keywords.Equals(name, input.Atoms.Use)) {
UseKey = compiler.AddQuery(value, /*allowVars:*/false, /*allowKey*/false);
}
else {
if (! compiler.ForwardCompatibility) {
throw XsltException.InvalidAttribute(element, name);
}
}
}
while(input.MoveToNextAttribute());
input.ToParent();
}
CheckRequiredAttribute(compiler, MatchKey != Compiler.InvalidQueryKey, Keywords.s_Match);
CheckRequiredAttribute(compiler, UseKey != Compiler.InvalidQueryKey, Keywords.s_Use );
CheckRequiredAttribute(compiler, Name != null , Keywords.s_Name );
compiler.InsertKey(Name, MatchKey, UseKey);
}