Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ElementAction.cs
Go to the documentation of this file.
2
4
6{
7 private Avt _nameAvt;
8
9 private Avt _nsAvt;
10
11 private bool _empty;
12
14
15 private string _name;
16
17 private string _nsUri;
18
20
21 internal ElementAction()
22 {
23 }
24
25 private static PrefixQName CreateElementQName(string name, string nsUri, InputScopeManager manager)
26 {
27 if (nsUri == "http://www.w3.org/2000/xmlns/")
28 {
30 }
32 prefixQName.SetQName(name);
33 if (nsUri == null)
34 {
35 prefixQName.Namespace = manager.ResolveXmlNamespace(prefixQName.Prefix);
36 }
37 else
38 {
40 }
41 return prefixQName;
42 }
43
44 internal override void Compile(Compiler compiler)
45 {
50 if (_nameAvt == null && _nsAvt == null)
51 {
52 if (_name != "xmlns")
53 {
54 _qname = CreateElementQName(_name, _nsUri, compiler.CloneScopeManager());
55 }
56 }
57 else
58 {
59 _manager = compiler.CloneScopeManager();
60 }
61 if (compiler.Recurse())
62 {
64 compiler.ToParent();
65 }
66 _empty = containedActions == null;
67 }
68
69 internal override bool CompileAttribute(Compiler compiler)
70 {
71 string localName = compiler.Input.LocalName;
72 string value = compiler.Input.Value;
73 if (Ref.Equal(localName, compiler.Atoms.Name))
74 {
76 }
77 else if (Ref.Equal(localName, compiler.Atoms.Namespace))
78 {
80 }
81 else
82 {
83 if (!Ref.Equal(localName, compiler.Atoms.UseAttributeSets))
84 {
85 return false;
86 }
87 AddAction(compiler.CreateUseAttributeSetsAction());
88 }
89 return true;
90 }
91
92 internal override void Execute(Processor processor, ActionFrame frame)
93 {
94 switch (frame.State)
95 {
96 default:
97 return;
98 case 0:
99 if (_qname != null)
100 {
102 }
103 else
104 {
106 }
107 goto case 2;
108 case 2:
109 {
111 if (!processor.BeginEvent(XPathNodeType.Element, calulatedName.Prefix, calulatedName.Name, calulatedName.Namespace, _empty))
112 {
113 frame.State = 2;
114 return;
115 }
116 if (!_empty)
117 {
118 processor.PushActionFrame(frame);
119 frame.State = 1;
120 return;
121 }
122 break;
123 }
124 case 1:
125 break;
126 }
127 if (!processor.EndEvent(XPathNodeType.Element))
128 {
129 frame.State = 1;
130 }
131 else
132 {
133 frame.Finished();
134 }
135 }
136}
static string Xslt_ReservedNS
Definition SR.cs:1958
Definition SR.cs:7
static bool Equal(string strA, string strB)
Definition Ref.cs:5
static XsltException Create(string res, params string[] args)
string Evaluate(Processor processor, ActionFrame frame)
Definition Avt.cs:37
static Avt CompileAvt(Compiler compiler, string avtText)
Definition Avt.cs:52
void CompileAttributes(Compiler compiler)
void CheckRequiredAttribute(Compiler compiler, object attrValue, string attrName)
static string PrecalculateAvt(ref Avt avt)
override bool CompileAttribute(Compiler compiler)
override void Compile(Compiler compiler)
static PrefixQName CreateElementQName(string name, string nsUri, InputScopeManager manager)
override void Execute(Processor processor, ActionFrame frame)