本文整理汇总了C#中System.Xml.Xsl.Compiler类的典型用法代码示例。如果您正苦于以下问题:C# Compiler类的具体用法?C# Compiler怎么用?C# Compiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Compiler类属于System.Xml.Xsl命名空间,在下文中一共展示了Compiler类的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: CompileSingle
internal virtual void CompileSingle(Compiler compiler) {
this.match = Compiler.RootQuery;
this.matchKey = Compiler.RootQueryKey;
this.priority = Compiler.RootPriority;
CompileOnceTemplate(compiler);
}
示例3: CompileAttributes
public void CompileAttributes(Compiler compiler) {
NavigatorInput input = compiler.Input;
string element = input.LocalName;
if (input.MoveToFirstAttribute()) {
do {
Debug.TraceAttribute(input);
if (! Keywords.Equals(input.NamespaceURI, input.Atoms.Empty)) continue;
try {
if (CompileAttribute(compiler) == false) {
throw XsltException.InvalidAttribute(element, input.LocalName);
}
}catch(Exception) {
if (! compiler.ForwardCompatibility) {
throw;
}
else {
// In ForwardCompatibility mode we ignoreing all unknown or incorrect attributes
// If it's mandatory attribute we'l notice it absents later.
}
}
}
while (input.MoveToNextAttribute());
input.ToParent();
}
}
示例4: Compile
protected override void Compile (Compiler c)
{
if (c.Debugger != null)
c.Debugger.DebugCompile (this.DebugInput);
prefix = c.Input.Prefix;
string alias = c.CurrentStylesheet.GetActualPrefix (prefix);
if (alias != prefix) {
prefix = alias;
nsUri = c.Input.GetNamespace (alias);
}
else
nsUri = c.Input.NamespaceURI;
this.localname = c.Input.LocalName;
this.useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets", XsltNamespace);
this.nsDecls = c.GetNamespacesToCopy ();
if (nsDecls.Count == 0) nsDecls = null;
this.isEmptyElement = c.Input.IsEmptyElement;
if (c.Input.MoveToFirstAttribute ())
{
attrs = new ArrayList ();
do {
if (c.Input.NamespaceURI == XsltNamespace)
continue; //already handled
attrs.Add (new XslLiteralAttribute (c));
} while (c.Input.MoveToNextAttribute());
c.Input.MoveToParent ();
}
if (!c.Input.MoveToFirstChild ()) return;
children = c.CompileTemplateContent ();
c.Input.MoveToParent ();
}
示例5: 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");
}
示例6: 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();
}
}
示例7: Compile
internal override void Compile(Compiler compiler) {
CheckEmpty(compiler);
if (! compiler.CanHaveApplyImports) {
throw new XsltException(Res.Xslt_ApplyImports);
}
this.mode = compiler.CurrentMode;
this.stylesheet = compiler.CompiledStylesheet;
}
示例8: XslTemplateContent
public XslTemplateContent (Compiler c,
XPathNodeType parentType, bool xslForEach)
: base (c)
{
this.parentType = parentType;
this.xslForEach = xslForEach;
Compile (c);
}
示例9: Compile
internal override void Compile(Compiler compiler) {
CompileAttributes(compiler);
if (compiler.Recurse()) {
CompileTemplate(compiler);
compiler.ToParent();
}
}
示例10: Compile
internal override void Compile(Compiler compiler) {
CompileAttributes(compiler);
if (compiler.Recurse()) {
CompileConditions(compiler);
compiler.ToParent();
}
}
示例11: CompileAvt
internal static Avt CompileAvt(Compiler compiler, string avtText) {
Debug.Assert(compiler != null);
Debug.Assert(avtText != null);
new ArrayList();
bool constant;
ArrayList list = compiler.CompileAvt(avtText, out constant);
return constant ? new Avt(avtText) : new Avt(list);
}
示例12: Compile
internal override void Compile(Compiler compiler) {
XPathNavigator nav = compiler.Input.Navigator.Clone();
string name = nav.Name;
nav.MoveToParent();
string parent = nav.Name;
if (compiler.Recurse()) {
CompileSelectiveTemplate(compiler);
compiler.ToParent();
}
}
示例13: 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"));
}
示例14: Compile
internal override void Compile(Compiler compiler) {
Debug.Assert(!IsBuiltInAction);
CompileAttributes(compiler);
CompileContent(compiler);
if (this.sort && this.selectKey == Compiler.InvalidQueryKey){
this.select = "child::node()";
this.selectKey = compiler.AddQuery(this.select);
}
}
示例15: CompileStylesheetAttributes
internal void CompileStylesheetAttributes(Compiler compiler) {
NavigatorInput input = compiler.Input;
string element = input.LocalName;
string badAttribute = null;
string version = null;
if (input.MoveToFirstAttribute()) {
do {
Debug.TraceAttribute(input);
string nspace = input.NamespaceURI;
string name = input.LocalName;
if (! Keywords.Equals(nspace, input.Atoms.Empty)) continue;
Debug.WriteLine("Attribute name: \"" + name + "\"");
if (Keywords.Equals(name, input.Atoms.Version)) {
version = input.Value;
if (1 <= XmlConvert.ToXPathDouble(version)) {
compiler.ForwardCompatibility = (version != Keywords.s_Version10);
}
else {
// XmlConvert.ToXPathDouble(version) an be NaN!
if (! compiler.ForwardCompatibility) {
throw XsltException.InvalidAttrValue(Keywords.s_Version, version);
}
}
Debug.WriteLine("Version found: \"" + version + "\"");
}
else if (Keywords.Equals(name, input.Atoms.ExtensionElementPrefixes)) {
compiler.InsertExtensionNamespace(input.Value);
}
else if (Keywords.Equals(name, input.Atoms.ExcludeResultPrefixes)) {
compiler.InsertExcludedNamespace(input.Value);
}
else if (Keywords.Equals(name, input.Atoms.Id)) {
// Do nothing here.
}
else {
// We can have version atribute later. For now remember this attribute and continue
badAttribute = name;
}
}
while( input.MoveToNextAttribute());
input.ToParent();
}
if (version == null) {
throw new XsltException(Res.Xslt_MissingAttribute, Keywords.s_Version);
}
if (badAttribute != null && ! compiler.ForwardCompatibility) {
throw XsltException.InvalidAttribute(element, badAttribute);
}
}