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

◆ LoadExternals()

void System.Xml.Schema.SchemaCollectionPreprocessor.LoadExternals ( XmlSchema schema,
XmlSchemaCollection xsc )
inlineprivate

Definition at line 115 of file SchemaCollectionPreprocessor.cs.

116 {
117 if (schema.IsProcessing)
118 {
119 return;
120 }
121 schema.IsProcessing = true;
122 for (int i = 0; i < schema.Includes.Count; i++)
123 {
124 XmlSchemaExternal xmlSchemaExternal = (XmlSchemaExternal)schema.Includes[i];
125 Uri uri = null;
126 if (xmlSchemaExternal.Schema != null)
127 {
128 if (xmlSchemaExternal is XmlSchemaImport && ((XmlSchemaImport)xmlSchemaExternal).Namespace == "http://www.w3.org/XML/1998/namespace")
129 {
130 _buildinIncluded = true;
131 continue;
132 }
133 uri = xmlSchemaExternal.BaseUri;
134 if (uri != null && _schemaLocations[uri] == null)
135 {
136 _schemaLocations.Add(uri, uri);
137 }
139 continue;
140 }
141 if (xsc != null && xmlSchemaExternal is XmlSchemaImport)
142 {
143 XmlSchemaImport xmlSchemaImport = (XmlSchemaImport)xmlSchemaExternal;
144 string ns = ((xmlSchemaImport.Namespace != null) ? xmlSchemaImport.Namespace : string.Empty);
146 if (xmlSchemaExternal.Schema != null)
147 {
149 if (xmlSchemaExternal.Schema.BaseUri != null && _schemaLocations[xmlSchemaExternal.Schema.BaseUri] == null)
150 {
151 _schemaLocations.Add(xmlSchemaExternal.Schema.BaseUri, xmlSchemaExternal.Schema.BaseUri);
152 }
153 Uri uri2 = null;
154 for (int j = 0; j < xmlSchemaExternal.Schema.Includes.Count; j++)
155 {
156 XmlSchemaExternal xmlSchemaExternal2 = (XmlSchemaExternal)xmlSchemaExternal.Schema.Includes[j];
157 if (!(xmlSchemaExternal2 is XmlSchemaImport))
158 {
159 continue;
160 }
161 XmlSchemaImport xmlSchemaImport2 = (XmlSchemaImport)xmlSchemaExternal2;
162 uri2 = ((xmlSchemaImport2.BaseUri != null) ? xmlSchemaImport2.BaseUri : ((xmlSchemaImport2.Schema != null && xmlSchemaImport2.Schema.BaseUri != null) ? xmlSchemaImport2.Schema.BaseUri : null));
163 if (uri2 != null)
164 {
165 if (_schemaLocations[uri2] != null)
166 {
168 }
169 else
170 {
172 }
173 }
174 }
175 continue;
176 }
177 }
178 if (xmlSchemaExternal is XmlSchemaImport && ((XmlSchemaImport)xmlSchemaExternal).Namespace == "http://www.w3.org/XML/1998/namespace")
179 {
180 if (!_buildinIncluded)
181 {
182 _buildinIncluded = true;
183 xmlSchemaExternal.Schema = Preprocessor.GetBuildInSchema();
184 }
185 continue;
186 }
187 string schemaLocation = xmlSchemaExternal.SchemaLocation;
188 if (schemaLocation == null)
189 {
190 continue;
191 }
193 if (!(uri3 != null) || _schemaLocations[uri3] != null)
194 {
195 continue;
196 }
198 if (schemaEntity != null)
199 {
202 XmlTextReader xmlTextReader = new XmlTextReader(uri3.ToString(), schemaEntity, base.NameTable);
204 try
205 {
206 Parser parser = new Parser(SchemaType.XSD, base.NameTable, base.SchemaNames, base.EventHandler);
207 parser.Parse(xmlTextReader, null);
208 while (xmlTextReader.Read())
209 {
210 }
213 }
214 catch (XmlSchemaException ex)
215 {
216 SendValidationEventNoThrow(new XmlSchemaException(System.SR.Sch_CannotLoadSchema, new string[2] { schemaLocation, ex.Message }, ex.SourceUri, ex.LineNumber, ex.LinePosition), XmlSeverityType.Error);
217 }
218 catch (Exception)
219 {
221 }
222 finally
223 {
224 xmlTextReader.Close();
225 }
226 }
227 else
228 {
230 }
231 }
232 schema.IsProcessing = false;
233 }
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
static string Sch_InvalidIncludeLocation
Definition SR.cs:1076
static string Sch_CannotLoadSchema
Definition SR.cs:1078
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
void SendValidationEventNoThrow(XmlSchemaException e, XmlSeverityType severity)
void LoadExternals(XmlSchema schema, XmlSchemaCollection xsc)
Uri ResolveSchemaLocationUri(XmlSchema enclosingSchema, string location)

References System.Xml.Schema.SchemaCollectionPreprocessor._buildinIncluded, System.Xml.Schema.SchemaCollectionPreprocessor._schemaLocations, System.Xml.Schema.SchemaCollectionPreprocessor._xmlResolver, System.Collections.Hashtable.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.Schema.Preprocessor.GetBuildInSchema(), System.Xml.Schema.SchemaCollectionPreprocessor.GetSchemaEntity(), System.Xml.Schema.SchemaCollectionPreprocessor.LoadExternals(), System.Xml.Schema.Namespace, System.Xml.Schema.SchemaCollectionPreprocessor.ResolveSchemaLocationUri(), System.SR.Sch_CannotLoadSchema, System.SR.Sch_InvalidIncludeLocation, System.Xml.Schema.BaseProcessor.SendValidationEvent(), and System.Xml.Schema.BaseProcessor.SendValidationEventNoThrow().

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