Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ LoadExternals()

void System.Xml.Schema.Preprocessor.LoadExternals ( XmlSchema schema)
inlineprivate

Definition at line 215 of file Preprocessor.cs.

216 {
217 if (schema.IsProcessing)
218 {
219 return;
220 }
221 schema.IsProcessing = true;
222 for (int i = 0; i < schema.Includes.Count; i++)
223 {
224 Uri uri = null;
225 XmlSchemaExternal xmlSchemaExternal = (XmlSchemaExternal)schema.Includes[i];
226 XmlSchema schema2 = xmlSchemaExternal.Schema;
227 if (schema2 != null)
228 {
229 uri = schema2.BaseUri;
230 if (uri != null && _schemaLocations[uri] == null)
231 {
233 }
235 continue;
236 }
237 string schemaLocation = xmlSchemaExternal.SchemaLocation;
238 Uri uri2 = null;
239 Exception innerException = null;
240 if (schemaLocation != null)
241 {
242 try
243 {
245 }
246 catch (Exception ex)
247 {
248 uri2 = null;
250 }
251 }
252 if (xmlSchemaExternal.Compositor == Compositor.Import)
253 {
254 XmlSchemaImport xmlSchemaImport = xmlSchemaExternal as XmlSchemaImport;
255 string text = ((xmlSchemaImport.Namespace != null) ? xmlSchemaImport.Namespace : string.Empty);
256 if (!schema.ImportedNamespaces.Contains(text))
257 {
258 schema.ImportedNamespaces.Add(text);
259 }
260 if (text == "http://www.w3.org/XML/1998/namespace" && uri2 == null)
261 {
263 continue;
264 }
265 }
266 if (uri2 == null)
267 {
268 if (schemaLocation != null)
269 {
271 }
272 }
273 else if (_schemaLocations[uri2] == null)
274 {
275 object obj = null;
276 try
277 {
279 }
280 catch (Exception ex2)
281 {
283 obj = null;
284 }
285 if (obj != null)
286 {
288 Type type = obj.GetType();
289 if (typeof(XmlSchema).IsAssignableFrom(type))
290 {
291 xmlSchemaExternal.Schema = (XmlSchema)obj;
294 continue;
295 }
296 XmlReader xmlReader = null;
297 if (type.IsSubclassOf(typeof(Stream)))
298 {
301 xmlReader = XmlReader.Create((Stream)obj, _readerSettings, uri2.ToString());
302 }
303 else if (type.IsSubclassOf(typeof(XmlReader)))
304 {
305 xmlReader = (XmlReader)obj;
306 }
307 else if (type.IsSubclassOf(typeof(TextReader)))
308 {
311 xmlReader = XmlReader.Create((TextReader)obj, _readerSettings, uri2.ToString());
312 }
313 if (xmlReader == null)
314 {
316 continue;
317 }
318 try
319 {
320 Parser parser = new Parser(SchemaType.XSD, base.NameTable, base.SchemaNames, base.EventHandler);
321 parser.Parse(xmlReader, null);
322 while (xmlReader.Read())
323 {
324 }
328 }
329 catch (XmlSchemaException ex3)
330 {
331 SendValidationEvent(System.SR.Sch_CannotLoadSchemaLocation, schemaLocation, ex3.Message, ex3.SourceUri, ex3.LineNumber, ex3.LinePosition);
332 }
333 catch (Exception innerException2)
334 {
336 }
337 finally
338 {
339 xmlReader.Close();
340 }
341 }
342 else
343 {
345 }
346 }
347 else
348 {
350 }
351 }
352 }
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
static string Sch_InvalidIncludeLocation
Definition SR.cs:1076
static string Sch_CannotLoadSchemaLocation
Definition SR.cs:1080
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
void LoadExternals(XmlSchema schema)
static XmlSchema GetBuildInSchema()
Uri ResolveSchemaLocationUri(XmlSchema enclosingSchema, string location)
XmlReaderSettings _readerSettings

References System.Xml.Schema.Preprocessor._readerSettings, System.Xml.Schema.Preprocessor._schemaLocations, System.Xml.Schema.Preprocessor._xmlResolver, System.Collections.Hashtable.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.XmlReader.Create(), System.Xml.Dictionary, System.Xml.Schema.Preprocessor.GetBuildInSchema(), System.Xml.Schema.Preprocessor.GetSchemaEntity(), System.Type.GetType(), System.Xml.Schema.Preprocessor.LoadExternals(), System.obj, System.Xml.Schema.Preprocessor.ResolveSchemaLocationUri(), System.SR.Sch_CannotLoadSchemaLocation, System.SR.Sch_InvalidIncludeLocation, System.Xml.Schema.BaseProcessor.SendValidationEvent(), System.text, and System.type.

Referenced by System.Xml.Schema.Preprocessor.Execute(), and System.Xml.Schema.Preprocessor.LoadExternals().