Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Asttree.cs
Go to the documentation of this file.
4
5namespace System.Xml.Schema;
6
7internal sealed class Asttree
8{
10
11 private readonly string _xpathexpr;
12
13 private readonly bool _isField;
14
15 private readonly XmlNamespaceManager _nsmgr;
16
18
26
27 private static bool IsNameTest(Axis ast)
28 {
29 if (ast.TypeOfAxis == Axis.AxisType.Child)
30 {
31 return ast.NodeType == XPathNodeType.Element;
32 }
33 return false;
34 }
35
36 internal static bool IsAttribute(Axis ast)
37 {
38 if (ast.TypeOfAxis == Axis.AxisType.Attribute)
39 {
40 return ast.NodeType == XPathNodeType.Attribute;
41 }
42 return false;
43 }
44
45 private static bool IsDescendantOrSelf(Axis ast)
46 {
47 if (ast.TypeOfAxis == Axis.AxisType.DescendantOrSelf && ast.NodeType == XPathNodeType.All)
48 {
49 return ast.AbbrAxis;
50 }
51 return false;
52 }
53
54 internal static bool IsSelf(Axis ast)
55 {
56 if (ast.TypeOfAxis == Axis.AxisType.Self && ast.NodeType == XPathNodeType.All)
57 {
58 return ast.AbbrAxis;
59 }
60 return false;
61 }
62
64 {
65 if (xPath == null || xPath.Length == 0)
66 {
67 throw new XmlSchemaException(System.SR.Sch_EmptyXPath, string.Empty);
68 }
69 string[] array = xPath.Split('|');
70 ArrayList arrayList = new ArrayList(array.Length);
71 _fAxisArray = new ArrayList(array.Length);
72 try
73 {
74 for (int i = 0; i < array.Length; i++)
75 {
77 arrayList.Add(value);
78 }
79 }
80 catch
81 {
83 }
84 for (int j = 0; j < arrayList.Count; j++)
85 {
87 Axis axis2;
88 if ((axis2 = axis) == null)
89 {
91 }
93 if (IsAttribute(axis2))
94 {
95 if (!isField)
96 {
98 }
100 try
101 {
102 axis2 = (Axis)axis2.Input;
103 }
104 catch
105 {
107 }
108 }
109 while (axis2 != null && (IsNameTest(axis2) || IsSelf(axis2)))
110 {
111 if (IsSelf(axis2) && axis != axis2)
112 {
113 axis3.Input = axis2.Input;
114 }
115 else
116 {
117 axis3 = axis2;
118 if (IsNameTest(axis2))
119 {
121 }
122 }
123 try
124 {
125 axis2 = (Axis)axis2.Input;
126 }
127 catch
128 {
130 }
131 }
132 axis3.Input = null;
133 if (axis2 == null)
134 {
135 if (IsSelf(axis) && axis.Input != null)
136 {
138 }
139 else
140 {
142 }
143 continue;
144 }
146 {
148 }
149 try
150 {
151 axis2 = (Axis)axis2.Input;
152 }
153 catch
154 {
156 }
157 if (axis2 == null || !IsSelf(axis2) || axis2.Input != null)
158 {
160 }
161 if (IsSelf(axis) && axis.Input != null)
162 {
164 }
165 else
166 {
168 }
169 }
170 }
171
173 {
174 if (axis.Prefix.Length != 0)
175 {
176 axis.Urn = nsmgr.LookupNamespace(axis.Prefix);
177 if (axis.Urn == null)
178 {
180 }
181 }
182 else if (axis.Name.Length != 0)
183 {
184 axis.Urn = null;
185 }
186 else
187 {
188 axis.Urn = "";
189 }
190 }
191}
virtual int Add(object? value)
static string Sch_EmptyXPath
Definition SR.cs:728
static string Sch_UnresolvedPrefix
Definition SR.cs:730
static string Sch_ICXpathError
Definition SR.cs:734
static string Sch_SelectorAttr
Definition SR.cs:736
Definition SR.cs:7
static bool IsAttribute(Axis ast)
Definition Asttree.cs:36
static bool IsDescendantOrSelf(Axis ast)
Definition Asttree.cs:45
readonly string _xpathexpr
Definition Asttree.cs:11
static bool IsSelf(Axis ast)
Definition Asttree.cs:54
static bool IsNameTest(Axis ast)
Definition Asttree.cs:27
readonly XmlNamespaceManager _nsmgr
Definition Asttree.cs:15
void CompileXPath(string xPath, bool isField, XmlNamespaceManager nsmgr)
Definition Asttree.cs:63
readonly bool _isField
Definition Asttree.cs:13
Asttree(string xPath, bool isField, XmlNamespaceManager nsmgr)
Definition Asttree.cs:19
void SetURN(Axis axis, XmlNamespaceManager nsmgr)
Definition Asttree.cs:172
static DoubleLinkAxis ConvertTree(Axis axis)
static AstNode ParseXPathExpression(string xpathExpression)