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

◆ AddElement()

XmlSchemaElement System.Xml.Schema.XmlSchemaInference.AddElement ( string localName,
string prefix,
string childURI,
XmlSchema parentSchema,
XmlSchemaObjectCollection addLocation,
int positionWithinCollection )
inlineprivate

Definition at line 378 of file XmlSchemaInference.cs.

379 {
380 if (childURI == "http://www.w3.org/2001/XMLSchema")
381 {
382 throw new XmlSchemaInferenceException(System.SR.SchInf_schema, 0, 0);
383 }
384 XmlSchemaElement xmlSchemaElement = null;
385 XmlSchemaElement xmlSchemaElement2 = xmlSchemaElement;
386 XmlSchema parentSchema2 = null;
387 bool bCreatingNewType = true;
388 if (childURI == string.Empty)
389 {
390 childURI = null;
391 }
392 if (parentSchema != null && childURI == parentSchema.TargetNamespace)
393 {
394 xmlSchemaElement = new XmlSchemaElement();
395 xmlSchemaElement.Name = localName;
397 if (parentSchema2.ElementFormDefault != XmlSchemaForm.Qualified && addLocation != null)
398 {
399 xmlSchemaElement.Form = XmlSchemaForm.Qualified;
400 }
401 }
402 else if (_schemaSet.Contains(childURI))
403 {
405 if (xmlSchemaElement == null)
406 {
407 if (_schemaSet.Schemas(childURI) is ArrayList { Count: >0 } arrayList)
408 {
409 parentSchema2 = arrayList[0] as XmlSchema;
410 }
411 xmlSchemaElement = new XmlSchemaElement();
412 xmlSchemaElement.Name = localName;
414 }
415 else
416 {
417 bCreatingNewType = false;
418 }
419 }
420 else
421 {
423 if (prefix.Length != 0)
424 {
426 }
427 xmlSchemaElement = new XmlSchemaElement();
428 xmlSchemaElement.Name = localName;
430 }
431 if (parentSchema == null)
432 {
435 }
436 if (childURI != parentSchema.TargetNamespace)
437 {
438 bool flag = true;
439 for (int i = 0; i < parentSchema.Includes.Count; i++)
440 {
441 if (parentSchema.Includes[i] is XmlSchemaImport xmlSchemaImport && xmlSchemaImport.Namespace == childURI)
442 {
443 flag = false;
444 }
445 }
446 if (flag)
447 {
448 XmlSchemaImport xmlSchemaImport2 = new XmlSchemaImport();
451 parentSchema.Includes.Add(xmlSchemaImport2);
452 }
453 }
455 if (addLocation != null)
456 {
457 if (childURI == parentSchema.TargetNamespace)
458 {
459 if (Occurrence == InferenceOption.Relaxed)
460 {
462 }
463 if (positionWithinCollection == -1)
464 {
466 }
467 else
468 {
470 }
471 }
472 else
473 {
474 XmlSchemaElement xmlSchemaElement3 = new XmlSchemaElement();
475 xmlSchemaElement3.RefName = new XmlQualifiedName(localName, childURI);
476 if (Occurrence == InferenceOption.Relaxed)
477 {
479 }
480 if (positionWithinCollection == -1)
481 {
483 }
484 else
485 {
487 }
489 }
490 }
492 return xmlSchemaElement2;
493 }
static string SchInf_schema
Definition SR.cs:1208
Definition SR.cs:7
XmlSchema CreateXmlSchema(string targetNS)
XmlSchemaElement FindGlobalElement(string namespaceURI, string localName, out XmlSchema parentSchema)
void InferElement(XmlSchemaElement xse, bool bCreatingNewType, XmlSchema parentSchema)
readonly XmlNamespaceManager _namespaceManager
bool Contains(string? targetNamespace)
virtual void AddNamespace(string prefix, string uri)

References System.Xml.Schema.XmlSchemaObjectCollection.Add(), System.Xml.Schema.XmlSchemaSet.Contains(), System.Collections.CollectionBase.Count, System.Xml.Schema.XmlSchema.ElementFormDefault, System.Xml.Schema.XmlSchema.Includes, System.Xml.Schema.XmlSchemaObjectCollection.Insert(), System.Xml.Schema.XmlSchema.Items, System.Xml.Schema.XmlSchemaImport.Namespace, System.prefix, System.Xml.Schema.XmlSchemaSet.Schemas(), System.SR.SchInf_schema, and System.Xml.Schema.XmlSchema.TargetNamespace.

Referenced by System.Xml.Schema.XmlSchemaInference.InferSchema1().