本文整理匯總了C#中System.Xml.Xsl.Compiler.CheckExtraAttributes方法的典型用法代碼示例。如果您正苦於以下問題:C# Compiler.CheckExtraAttributes方法的具體用法?C# Compiler.CheckExtraAttributes怎麽用?C# Compiler.CheckExtraAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.Xsl.Compiler
的用法示例。
在下文中一共展示了Compiler.CheckExtraAttributes方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (this.DebugInput);
c.CheckExtraAttributes ("value-of", "select", "disable-output-escaping");
c.AssertAttribute ("select");
select = c.CompileExpression (c.GetAttribute ("select"));
disableOutputEscaping = c.ParseYesNoAttribute ("disable-output-escaping", false);
if (c.Input.MoveToFirstChild ()) {
do {
switch (c.Input.NodeType) {
case XPathNodeType.Element:
if (c.Input.NamespaceURI == XsltNamespace)
goto case XPathNodeType.SignificantWhitespace;
// otherwise element in external namespace -> ignore
break;
case XPathNodeType.Text:
case XPathNodeType.SignificantWhitespace:
throw new XsltCompileException ("XSLT value-of element cannot contain any child.", null, c.Input);
}
} while (c.Input.MoveToNext ());
}
}
示例2: 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");
}
示例3: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (c.Input);
c.CheckExtraAttributes ("copy-of", "select");
c.AssertAttribute ("select");
select = c.CompileExpression (c.GetAttribute ("select"));
}
示例4: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (c.Input);
c.CheckExtraAttributes ("choose");
if (!c.Input.MoveToFirstChild ())
throw new XsltCompileException ("Expecting non-empty element", null, c.Input);
do {
if (c.Input.NodeType != XPathNodeType.Element) continue;
if (c.Input.NamespaceURI != XsltNamespace) continue;
if (defaultChoice != null)
throw new XsltCompileException ("otherwise attribute must be last", null, c.Input);
switch (c.Input.LocalName) {
case "when":
conditions.Add (new XslIf (c));
break;
case "otherwise":
c.CheckExtraAttributes ("otherwise");
if (c.Input.MoveToFirstChild ()) {
defaultChoice = c.CompileTemplateContent ();
c.Input.MoveToParent ();
}
break;
default:
if (c.CurrentStylesheet.Version == "1.0")
throw new XsltCompileException ("XSLT choose element accepts only when and otherwise elements", null, c.Input);
break;
}
} while (c.Input.MoveToNext ());
c.Input.MoveToParent ();
if (conditions.Count == 0)
throw new XsltCompileException ("Choose must have 1 or more when elements", null, c.Input);
}
示例5: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (c.Input);
c.CheckExtraAttributes ("fallback");
if (!c.Input.MoveToFirstChild ()) return;
children = c.CompileTemplateContent ();
c.Input.MoveToParent ();
}
示例6: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (this.DebugInput);
c.CheckExtraAttributes ("text", "disable-output-escaping");
this.text = c.Input.Value;
if (c.Input.NodeType == XPathNodeType.Element)
this.disableOutputEscaping = c.ParseYesNoAttribute ("disable-output-escaping", false);
}
示例7: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (c.Input);
c.CheckExtraAttributes ("comment");
if (c.Input.MoveToFirstChild ()) {
value = c.CompileTemplateContent (XPathNodeType.Comment);
c.Input.MoveToParent ();
}
}
示例8: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (c.Input);
c.CheckExtraAttributes ("apply-templates", "select", "mode");
select = c.CompileExpression (c.GetAttribute ("select"));
mode = c.ParseQNameAttribute ("mode");
ArrayList sorterList = null;
if (c.Input.MoveToFirstChild ()) {
do {
switch (c.Input.NodeType) {
case XPathNodeType.Comment:
case XPathNodeType.ProcessingInstruction:
case XPathNodeType.Whitespace:
case XPathNodeType.SignificantWhitespace:
continue;
case XPathNodeType.Element:
if (c.Input.NamespaceURI != XsltNamespace)
throw new XsltCompileException ("Unexpected element", null, c.Input); // TODO: fwd compat
switch (c.Input.LocalName)
{
case "with-param":
if (withParams == null)
withParams = new ArrayList ();
withParams.Add (new XslVariableInformation (c));
break;
case "sort":
if (sorterList == null)
sorterList = new ArrayList ();
if (select == null)
select = c.CompileExpression ("*");
sorterList.Add (new Sort (c));
//c.AddSort (select, new Sort (c));
break;
default:
throw new XsltCompileException ("Unexpected element", null, c.Input); // todo forwards compat
}
break;
default:
throw new XsltCompileException ("Unexpected node type " + c.Input.NodeType, null, c.Input); // todo forwards compat
}
} while (c.Input.MoveToNext ());
c.Input.MoveToParent ();
}
if (sorterList != null)
sortEvaluator = new XslSortEvaluator (select,
(Sort []) sorterList.ToArray (typeof (Sort)));
}
示例9: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (this.DebugInput);
c.CheckExtraAttributes ("message", "terminate");
terminate = c.ParseYesNoAttribute ("terminate", false);
if (!c.Input.MoveToFirstChild ()) return;
children = c.CompileTemplateContent ();
c.Input.MoveToParent ();
}
示例10: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (c.Input);
c.CheckExtraAttributes ("if", "test");
c.AssertAttribute ("test");
test = c.CompileExpression (c.GetAttribute ("test"));
if (!c.Input.MoveToFirstChild ()) return;
children = c.CompileTemplateContent ();
c.Input.MoveToParent ();
}
示例11: 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 ();
}
示例12: 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 ();
}
}
示例13: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (c.Input);
this.nsDecls = c.GetNamespacesToCopy ();
if (nsDecls.Count == 0)
nsDecls = null;
c.CheckExtraAttributes ("copy", "use-attribute-sets");
useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets");
if (!c.Input.MoveToFirstChild ()) return;
children = c.CompileTemplateContent();
c.Input.MoveToParent ();
}
示例14: 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 ();
}
}
示例15: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (c.Input);
c.CheckExtraAttributes ("call-template", "name");
c.AssertAttribute ("name");
name = c.ParseQNameAttribute ("name");
if (c.Input.MoveToFirstChild ()) {
do {
switch (c.Input.NodeType) {
case XPathNodeType.Comment:
case XPathNodeType.ProcessingInstruction:
case XPathNodeType.SignificantWhitespace:
case XPathNodeType.Whitespace:
continue;
case XPathNodeType.Element:
if (c.Input.NamespaceURI != XsltNamespace)
throw new XsltCompileException ("Unexpected element", null, c.Input); // TODO: fwd compat
switch (c.Input.LocalName)
{
case "with-param":
if (withParams == null) withParams = new ArrayList ();
withParams.Add (new XslVariableInformation (c));
break;
default:
throw new XsltCompileException ("Unexpected element", null, c.Input); // todo forwards compat
}
break;
default:
throw new XsltCompileException ("Unexpected node type " + c.Input.NodeType, null, c.Input); // TODO: fwd compat
}
} while (c.Input.MoveToNext ());
c.Input.MoveToParent ();
}
}